|
@@ -1,4 +1,3 @@
|
1
|
|
-
|
2
|
1
|
import React, {useState, useEffect} from 'react'
|
3
|
2
|
import { Button, Text, View, StyleSheet} from 'react-native'
|
4
|
3
|
import {FlatList, ListViewBase } from 'react-native'
|
|
@@ -9,7 +8,6 @@ import firebase from 'firebase';
|
9
|
8
|
import { styles } from "../../config/styles";
|
10
|
9
|
import { TextInput, TouchableWithoutFeedback, Keyboard, ImageBackground} from "react-native";
|
11
|
10
|
|
12
|
|
-
|
13
|
11
|
import { connect } from 'react-redux'
|
14
|
12
|
import { bindActionCreators } from 'redux'
|
15
|
13
|
import { fetchUser } from '../../redux/actions/index'
|
|
@@ -19,16 +17,12 @@ export function Home_page({navigation}) {
|
19
|
17
|
const [loading, setLoading] = useState(true);
|
20
|
18
|
|
21
|
19
|
const [roomName, setRoomName] = useState('');
|
22
|
|
- //const navigation = useNavigation();
|
23
|
|
- //const [roomName, setRoomName] = useState('');
|
24
|
20
|
|
25
|
21
|
useEffect(() => {
|
26
|
22
|
|
27
|
23
|
const fire = firebase.firestore()
|
28
|
|
- .collection('Users')
|
29
|
|
- .doc(firebase.auth().currentUser.uid)
|
30
|
24
|
.collection('THREADS')
|
31
|
|
-
|
|
25
|
+ .where("members", "array-contains", firebase.auth().currentUser.uid)
|
32
|
26
|
.onSnapshot(querySnapshot => {
|
33
|
27
|
const threads = querySnapshot.docs.map(documentSnapshot => {
|
34
|
28
|
return{
|
|
@@ -55,53 +49,20 @@ export function Home_page({navigation}) {
|
55
|
49
|
}
|
56
|
50
|
|
57
|
51
|
|
58
|
|
- function handleButtonPress() {
|
59
|
|
- if (roomName.length > 0) {
|
60
|
|
- firebase.firestore()
|
61
|
|
- .collection('Users')
|
62
|
|
- .doc(firebase.auth().currentUser.uid)
|
63
|
|
- .collection('THREADS')
|
64
|
|
- .add({
|
65
|
|
- name: roomName
|
66
|
|
- })
|
67
|
|
- //.then(() => {
|
68
|
|
- //navigation.navigate('allChats');
|
69
|
|
- //});
|
70
|
|
- }
|
71
|
|
- }
|
72
|
|
-
|
73
|
|
-
|
74
|
52
|
function handleButtonPress2() {
|
75
|
53
|
firebase.firestore()
|
76
|
|
- .collection('Users')
|
77
|
|
- .doc(firebase.auth().currentUser.uid)
|
78
|
54
|
.collection('THREADS')
|
79
|
55
|
.add({
|
80
|
|
- name: 'citaFechaHora4'
|
|
56
|
+ name: 'NombreFecha',
|
|
57
|
+ members: [
|
|
58
|
+ firebase.auth().currentUser.uid,
|
|
59
|
+ 'BhlrNDOqLOYSSlaEDK0nxZpQ2tD3'
|
|
60
|
+ ]
|
81
|
61
|
})
|
82
|
62
|
//.then(() => {
|
83
|
63
|
//navigation.navigate('allChats');
|
84
|
64
|
//});
|
85
|
|
-
|
86
|
|
- firebase.firestore()
|
87
|
|
- .collection('Users')
|
88
|
|
- .doc('HGGAJlcIfwdpUoYfcBKLZFcDude2')
|
89
|
|
- .collection('THREADS')
|
90
|
|
- .add({
|
91
|
|
- name: 'citaFechaHora4'
|
92
|
|
- })
|
93
|
|
-
|
94
|
|
- /*firebase.database().ref('Users/' + 'HGGAJlcIfwdpUoYfcBKLZFcDude2' + '/THREADS/')
|
95
|
|
- .push()
|
96
|
|
- .set({
|
97
|
|
- name: 'citaFechaHora3'
|
98
|
|
- })*/
|
99
|
65
|
}
|
100
|
|
-
|
101
|
|
-
|
102
|
|
-
|
103
|
|
-
|
104
|
|
-
|
105
|
66
|
|
106
|
67
|
return (
|
107
|
68
|
<ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
|
|
@@ -138,11 +99,6 @@ export function Home_page({navigation}) {
|
138
|
99
|
onPress={() => handleButtonPress2()}
|
139
|
100
|
/>
|
140
|
101
|
|
141
|
|
- <Button
|
142
|
|
- title='Provisional'
|
143
|
|
- onPress={() => handleButtonPress()}
|
144
|
|
- />
|
145
|
|
-
|
146
|
102
|
<Button
|
147
|
103
|
title ='Hacer Busqueda'
|
148
|
104
|
onPress= {() => navigation.navigate('Room')}
|
|
@@ -156,7 +112,4 @@ const mapStateToProps = (store) => ({
|
156
|
112
|
})
|
157
|
113
|
const mapDispatchProps = (dispatch) => bindActionCreators({fetchUser}, dispatch);
|
158
|
114
|
|
159
|
|
-export default connect(mapStateToProps, mapDispatchProps)(Home_page);
|
160
|
|
-
|
161
|
|
-
|
162
|
|
-
|
|
115
|
+export default connect(mapStateToProps, mapDispatchProps)(Home_page);
|