Pārlūkot izejas kodu

Update a Search para incluir el flag que indica si el usuario quiere una cita presencial

- Y se pasa a la proxima pantalla
gilberto.cancel 2 gadus atpakaļ
vecāks
revīzija
e04974064b
1 mainītis faili ar 9 papildinājumiem un 2 dzēšanām
  1. 9
    2
      screens/main/Search.js

+ 9
- 2
screens/main/Search.js Parādīt failu

@@ -5,6 +5,8 @@ import { xorBy } from 'lodash'
5 5
 import firebase from 'firebase'
6 6
 import { firebaseConfig } from '../../config/firebaseConfig'
7 7
   
8
+//Flag to indicate an IRL appointment.
9
+var mapflag = false
8 10
 
9 11
 if (firebase.apps.length === 0) {
10 12
   firebase.initializeApp(firebaseConfig)
@@ -99,16 +101,20 @@ function Search({ navigation }) {
99 101
     //reset the users usestate to empty
100 102
     const users = []
101 103
     
102
-    
103 104
 
104 105
     const db = firebase.firestore()
105 106
     var query = db.collection('Interprete')
106 107
     
107 108
     for (let i = 0; i < tags.length; i++) {
109
+
110
+      //Reset Flag.
111
+      mapflag = false
112
+
108 113
       //check which tags where called in the search 
109 114
       if (tags[i].id === 'PL') {
110 115
         console.log('Presencial')
111 116
         query = query.where('Modalidad.Presencial', '==', true)
117
+        mapflag = true
112 118
       }
113 119
       if (tags[i].id == 'ON') {
114 120
         query = query.where('Modalidad.Online', '==', true)
@@ -164,6 +170,7 @@ function Search({ navigation }) {
164 170
         }
165 171
         users.push(user)
166 172
         setUsers(users)
173
+        
167 174
       });
168 175
     });
169 176
     console.log('These are the users after the query is executed: ',  users)
@@ -261,7 +268,7 @@ function Search({ navigation }) {
261 268
   
262 269
   function dothing(item) {
263 270
     console.log('This is the item id: ', item)
264
-    navigation.navigate('Calendar', {Intereprete_id: item})
271
+    navigation.navigate('Calendar', {Intereprete_id: item, Flag: mapflag})
265 272
   } 
266 273
 
267 274
 }