|
@@ -13,13 +13,17 @@ import { bindActionCreators } from 'redux'
|
13
|
13
|
import { fetchUser } from '../../redux/actions/index'
|
14
|
14
|
|
15
|
15
|
|
16
|
|
-export function Cita({navigation, route}) {
|
17
|
|
- /*const [threads, setThreads] = useState([]);
|
18
|
|
- const [loading, setLoading] = useState(true);
|
19
|
|
- useEffect(() => {
|
|
16
|
+export function Cita({route, navigation}) {
|
|
17
|
+ const [threads, setThreads] = useState([]);
|
|
18
|
+ const [loading, setLoading] = useState(true);
|
|
19
|
+ console.log("ID", route.params);
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+ useEffect(() => {
|
20
|
24
|
const fire = firebase.firestore()
|
21
|
25
|
.collection('THREADS')
|
22
|
|
- .where("cita", "==", route.params.appointment_id)
|
|
26
|
+ .where("cita", "==", route.params)
|
23
|
27
|
.onSnapshot(querySnapshot => {
|
24
|
28
|
const threads = querySnapshot.docs.map(documentSnapshot => {
|
25
|
29
|
return{
|
|
@@ -40,7 +44,7 @@ export function Cita({navigation, route}) {
|
40
|
44
|
return () => {
|
41
|
45
|
fire();
|
42
|
46
|
}
|
43
|
|
- }, []);*/
|
|
47
|
+ }, []);
|
44
|
48
|
|
45
|
49
|
|
46
|
50
|
|
|
@@ -53,6 +57,27 @@ export function Cita({navigation, route}) {
|
53
|
57
|
|
54
|
58
|
return (
|
55
|
59
|
<ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
|
|
60
|
+ <FlatList style={{
|
|
61
|
+ flex: 1,
|
|
62
|
+ width: screenWidth,
|
|
63
|
+ }}
|
|
64
|
+ data={threads}
|
|
65
|
+ keyExtractor = {item => item._id}
|
|
66
|
+ ItemSeparatorComponent={() => <Divider />}
|
|
67
|
+ renderItem = {({item}) => (
|
|
68
|
+ <TouchableOpacity
|
|
69
|
+ onPress={() => navigation.navigate('Room', {thread: item})}
|
|
70
|
+ >
|
|
71
|
+ <List.Item
|
|
72
|
+ title={item.name}
|
|
73
|
+ titleNumberOfLines={1}
|
|
74
|
+ titleStyle={styles.listTitle}
|
|
75
|
+ descriptionStyle={styles.listDescription}
|
|
76
|
+ descriptionNumberOfLines={1}
|
|
77
|
+ />
|
|
78
|
+ </TouchableOpacity>
|
|
79
|
+ )}
|
|
80
|
+ />
|
56
|
81
|
<Button
|
57
|
82
|
title ='Ver mapa'
|
58
|
83
|
onPress= {() => navigation.navigate('Map')}
|