Переглянути джерело

Arregle mi error del Home

gilberto.cancel 3 роки тому
джерело
коміт
074b3f0fb2
1 змінених файлів з 81 додано та 129 видалено
  1. 81
    129
      screens/main/Home_page.js

+ 81
- 129
screens/main/Home_page.js Переглянути файл

37
   const notificationListener = useRef();
37
   const notificationListener = useRef();
38
   const responseListener = useRef();
38
   const responseListener = useRef();
39
 
39
 
40
+
40
   useEffect(() => {
41
   useEffect(() => {
41
     registerForPushNotificationsAsync().then(token => setExpoPushToken(token));
42
     registerForPushNotificationsAsync().then(token => setExpoPushToken(token));
42
     notificationListener.current = Notifications.addNotificationReceivedListener(notification => {
43
     notificationListener.current = Notifications.addNotificationReceivedListener(notification => {
45
 
46
 
46
     responseListener.current = Notifications.addNotificationResponseReceivedListener(response => {
47
     responseListener.current = Notifications.addNotificationResponseReceivedListener(response => {
47
       console.log(response);
48
       console.log(response);
49
+      navigation.navigate('Confirm');
48
     });
50
     });
49
 
51
 
50
     const fire = firebase.firestore()
52
     const fire = firebase.firestore()
108
         })
110
         })
109
   }
111
   }
110
 
112
 
113
+  const dimensions = Dimensions.get('window');
114
+  const screenWidth = dimensions.width;
115
+
116
+  
111
   function check_user_type_INT(){
117
   function check_user_type_INT(){
112
 
118
 
113
     
119
     
130
     }
136
     }
131
 
137
 
132
   }
138
   }
133
-
134
-  const dimensions = Dimensions.get('window');
135
-  const screenWidth = dimensions.width;
136
   
139
   
137
   check_user_type_INT();
140
   check_user_type_INT();
138
   console.log(interpreter);
141
   console.log(interpreter);
139
   if(interpreter == false){
142
   if(interpreter == false){
140
     return (
143
     return (
141
-        <ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
142
-          <FlatList style={{
143
-              flex: 1,
144
-              width: screenWidth,
145
-          }}
146
-            data={threads}
147
-            keyExtractor = {item => item._id}
148
-            ItemSeparatorComponent={() => <Divider />}
149
-            renderItem = {({item}) => (
150
-            <TouchableOpacity
151
-              onPress={() => navigation.navigate('Room', {thread: item})}
152
-            >
153
-              <List.Item
154
-                title={item.name}
155
-                titleNumberOfLines={1}
156
-                titleStyle={styles.listTitle}
157
-                descriptionStyle={styles.listDescription}
158
-                descriptionNumberOfLines={1}
159
-              />
160
-            </TouchableOpacity>
161
-          )}
144
+      <ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
145
+      <FlatList style={{
146
+           flex: 1,
147
+           width: screenWidth,
148
+       }}
149
+        data={appointments}
150
+        keyExtractor = {item => item._id}
151
+        ItemSeparatorComponent={() => <Divider />}
152
+        renderItem = {({item}) => (
153
+        <TouchableOpacity
154
+        onPress={async () => {
155
+          navigation.navigate('Cita')
156
+        }}
157
+        >
158
+          <List.Item
159
+            title={item.Month}
160
+            titleNumberOfLines={1}
161
+            titleStyle={styles.listTitle}
162
+            descriptionStyle={styles.listDescription}
163
+            descriptionNumberOfLines={1}
162
           />
164
           />
163
-          <FlatList style={{
164
-              flex: 1,
165
-              width: screenWidth,
166
-          }}
167
-            data={appointments}
168
-            keyExtractor = {item => item._id}
169
-            ItemSeparatorComponent={() => <Divider />}
170
-            renderItem = {({item}) => (
171
-            <TouchableOpacity
172
-            onPress={async () => {
173
-              await sendPushNotification(expoPushToken);
174
-            }}
175
-            >
176
-              <List.Item
177
-                title={item.Month}
178
-                titleNumberOfLines={1}
179
-                titleStyle={styles.listTitle}
180
-                descriptionStyle={styles.listDescription}
181
-                descriptionNumberOfLines={1}
182
-              />
183
-              <List.Item
184
-                title={item.Day}
185
-                titleNumberOfLines={1}
186
-                titleStyle={styles.listTitle}
187
-                descriptionStyle={styles.listDescription}
188
-                descriptionNumberOfLines={1}
189
-              />
190
-              <List.Item
191
-                title={item.Time}
192
-                titleNumberOfLines={1}
193
-                titleStyle={styles.listTitle}
194
-                descriptionStyle={styles.listDescription}
195
-                descriptionNumberOfLines={1}
196
-              />
197
-            </TouchableOpacity>
198
-          )}
165
+          <List.Item
166
+            title={item.Day}
167
+            titleNumberOfLines={1}
168
+            titleStyle={styles.listTitle}
169
+            descriptionStyle={styles.listDescription}
170
+            descriptionNumberOfLines={1}
171
+          />
172
+          <List.Item
173
+            title={item.Time}
174
+            titleNumberOfLines={1}
175
+            titleStyle={styles.listTitle}
176
+            descriptionStyle={styles.listDescription}
177
+            descriptionNumberOfLines={1}
178
+          />
179
+        </TouchableOpacity>
180
+      )}
199
           />
181
           />
200
         <Button
182
         <Button
201
             title ='Send notification'
183
             title ='Send notification'
204
             }}
186
             }}
205
           /> 
187
           /> 
206
         <Button
188
         <Button
207
-          title='CrearChat'
208
-          onPress={() => handleButtonPress()}
209
-        />
210
-        <Button
211
-          title ='Search for Interpreters'
189
+          title ='Hacer Busqueda'
212
           onPress= {() => navigation.navigate('Search')}
190
           onPress= {() => navigation.navigate('Search')}
213
         />
191
         />
214
         <Button
192
         <Button
220
     }
198
     }
221
     else{
199
     else{
222
       return (
200
       return (
223
-          <ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
224
-            <FlatList style={{
225
-                flex: 1,
226
-                width: screenWidth,
227
-            }}
228
-              data={threads}
229
-              keyExtractor = {item => item._id}
230
-              ItemSeparatorComponent={() => <Divider />}
231
-              renderItem = {({item}) => (
232
-              <TouchableOpacity
233
-                onPress={() => navigation.navigate('Room', {thread: item})}
234
-              >
235
-                <List.Item
236
-                  title={item.name}
237
-                  titleNumberOfLines={1}
238
-                  titleStyle={styles.listTitle}
239
-                  descriptionStyle={styles.listDescription}
240
-                  descriptionNumberOfLines={1}
241
-                />
242
-              </TouchableOpacity>
243
-            )}
201
+        <ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
202
+        <FlatList style={{
203
+             flex: 1,
204
+             width: screenWidth,
205
+         }}
206
+          data={appointments}
207
+          keyExtractor = {item => item._id}
208
+          ItemSeparatorComponent={() => <Divider />}
209
+          renderItem = {({item}) => (
210
+          <TouchableOpacity
211
+          onPress={async () => {
212
+            navigation.navigate('Cita')
213
+          }}
214
+          >
215
+            <List.Item
216
+              title={item.Month}
217
+              titleNumberOfLines={1}
218
+              titleStyle={styles.listTitle}
219
+              descriptionStyle={styles.listDescription}
220
+              descriptionNumberOfLines={1}
244
             />
221
             />
245
-            <FlatList style={{
246
-                flex: 1,
247
-                width: screenWidth,
248
-            }}
249
-              data={appointments}
250
-              keyExtractor = {item => item._id}
251
-              ItemSeparatorComponent={() => <Divider />}
252
-              renderItem = {({item}) => (
253
-              <TouchableOpacity
254
-              onPress={async () => {
255
-                await sendPushNotification(expoPushToken);
256
-              }}
257
-              >
258
-                <List.Item
259
-                  title={item.Month}
260
-                  titleNumberOfLines={1}
261
-                  titleStyle={styles.listTitle}
262
-                  descriptionStyle={styles.listDescription}
263
-                  descriptionNumberOfLines={1}
264
-                />
265
-                <List.Item
266
-                  title={item.Day}
267
-                  titleNumberOfLines={1}
268
-                  titleStyle={styles.listTitle}
269
-                  descriptionStyle={styles.listDescription}
270
-                  descriptionNumberOfLines={1}
271
-                />
272
-                <List.Item
273
-                  title={item.Time}
274
-                  titleNumberOfLines={1}
275
-                  titleStyle={styles.listTitle}
276
-                  descriptionStyle={styles.listDescription}
277
-                  descriptionNumberOfLines={1}
278
-                />
279
-              </TouchableOpacity>
280
-            )}
222
+            <List.Item
223
+              title={item.Day}
224
+              titleNumberOfLines={1}
225
+              titleStyle={styles.listTitle}
226
+              descriptionStyle={styles.listDescription}
227
+              descriptionNumberOfLines={1}
228
+            />
229
+            <List.Item
230
+              title={item.Time}
231
+              titleNumberOfLines={1}
232
+              titleStyle={styles.listTitle}
233
+              descriptionStyle={styles.listDescription}
234
+              descriptionNumberOfLines={1}
235
+            />
236
+          </TouchableOpacity>
237
+        )}
281
             />
238
             />
282
           <Button
239
           <Button
283
             title ='Send notification'
240
             title ='Send notification'
285
             await sendPushNotification(expoPushToken);
242
             await sendPushNotification(expoPushToken);
286
             }}
243
             }}
287
           /> 
244
           /> 
288
-
289
-          <Button
290
-            title='CrearChat'
291
-            onPress={() => handleButtonPress()}
292
-          />
293
           <Button
245
           <Button
294
           title ='Availability'
246
           title ='Availability'
295
           onPress= {() => navigation.navigate('Availability')}
247
           onPress= {() => navigation.navigate('Availability')}
307
   const message = {
259
   const message = {
308
     to: expoPushToken,
260
     to: expoPushToken,
309
     sound: 'default',
261
     sound: 'default',
310
-    title: 'Original Title',
311
-    body: 'And here is the body!',
262
+    title: 'Freehand',
263
+    body: 'Le solicitan una cita',
312
     data: { someData: 'goes here' },
264
     data: { someData: 'goes here' },
313
   };
265
   };
314
 
266