ErnestoOrtiz2 пре 3 година
родитељ
комит
1550db69a9
1 измењених фајлова са 12 додато и 68 уклоњено
  1. 12
    68
      screens/main/Home_page.js

+ 12
- 68
screens/main/Home_page.js Прегледај датотеку

@@ -15,77 +15,15 @@ import { bindActionCreators } from 'redux'
15 15
 import { fetchUser } from '../../redux/actions/index'
16 16
 
17 17
 export function Home_page({navigation}) {
18
-  const [threads, setThreads] = useState([]);  
19
-  const [loading, setLoading] = useState(true);
20 18
 
21
-  useEffect(() => {
22
-
23
-    const fire = firebase.firestore()
24
-    .collection('THREADS')
25
-    
26
-    .onSnapshot(querySnapshot => {
27
-      const threads = querySnapshot.docs.map(documentSnapshot => {
28
-        return{
29
-          _id:documentSnapshot.id,
30
-          name:'',
31
-          ...documentSnapshot.data()
32
-        };
33
-
34
-      });
35
-
36
-      setThreads(threads);
37
-
38
-      if(loading){
39
-        setLoading(false);
40
-      }
41
-
42
-    });
43
-
44
-    return () => fire();
45
-  }, []);
46
-  
47
-  if (loading) {
48
-    return <Loading />;
49
-  }
50
-  
51 19
   return (
52
-    <View>
53
-    <ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
54
-        <FlatList
55
-          data={threads}
56
-          keyExtractor = {item => item._id}
57
-          ItemSeparatorComponent={() => <Divider />}
58
-          renderItem = {({item}) => (
59
-
60
-            <TouchableOpacity
61
-            onPress={() => navigation.navigate('Room', {thread: item})}
62
-            
63
-            >
64
-            <List.Item
65
-              title={item.name}
66
-              description='Item description'
67
-              titleNumberOfLines={1}
68
-              titleStyle={styles.listTitle}
69
-              descriptionStyle={styles.listDescription}
70
-              descriptionNumberOfLines={1}
71
-            />
72
-          </TouchableOpacity>
73
-        )}
74
-      />
75
-
76
-      <Button
77
-        title='Ver mensajes'
78
-        onPress={() => navigation.navigate('Add')}
79
-      />
80
-
81
-        <Button
82
-        title ='Hacer Busqueda'
83
-        onPress= {() => navigation.navigate('Room')}
84
-        />
20
+    <TouchableWithoutFeedback style={styles.stdcontainer} onPress={Keyboard.dismiss} accessible={false}>
21
+        <ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
22
+            <CustomButton marginTop={25} title="Calendar" onPress={() => navigation.navigate('Calendar')}/>
85 23
         </ImageBackground>
86
-      </View>
87
-    );
88
-  }
24
+    </TouchableWithoutFeedback>
25
+  );
26
+}
89 27
 
90 28
 const mapStateToProps = (store) => ({
91 29
   currentUser: store.userState.currentUser
@@ -93,6 +31,12 @@ const mapStateToProps = (store) => ({
93 31
 const mapDispatchProps = (dispatch) => bindActionCreators({fetchUser}, dispatch);
94 32
 
95 33
 export default connect(mapStateToProps, mapDispatchProps)(Home_page);
34
+const mapStateToProps = (store) => ({
35
+  currentUser: store.userState.currentUser
36
+})
37
+const mapDispatchProps = (dispatch) => bindActionCreators({fetchUser}, dispatch);
38
+
39
+export default connect(mapStateToProps, mapDispatchProps)(Home_page);
96 40
 
97 41
 
98 42