Browse Source

Merge de cambios main/Home_page.js y main/RoomScreen.js

ErnestoOrtiz2 3 years ago
parent
commit
9a99216c86
5 changed files with 253 additions and 3 deletions
  1. 18
    1
      App.js
  2. 137
    0
      package-lock.json
  3. 1
    0
      package.json
  4. 93
    2
      screens/main/Home_page.js
  5. 4
    0
      screens/main/RoomScreen.js

+ 18
- 1
App.js View File

@@ -17,6 +17,16 @@ import HomeScreen from './screens/HomeScreen';
17 17
 //import Loading from './components/Loading';
18 18
 import Loading from './screens/main/Loading';
19 19
 import { firebaseConfig } from './config/firebaseConfig';
20
+<<<<<<< HEAD
21
+=======
22
+import { Text, View } from 'react-native';
23
+import { styles } from './config/styles';
24
+
25
+import HomeScreen from './screens/main/Home_page';
26
+import RoomScreen from './screens/main/RoomScreen'
27
+import { Provider} from 'react-redux'
28
+import { createStore, applyMiddleware } from 'redux';
29
+>>>>>>> devErnesto
20 30
 import rootReducer from './redux/reducers'
21 31
 
22 32
 
@@ -75,7 +85,7 @@ export default class App extends Component {
75 85
       return (
76 86
         <NavigationContainer>
77 87
           <Stack.Navigator>
78
-            <Stack.Screen name={" "} options={{headerShown: false}} component={LoginScreen}/>
88
+            <Stack.Screen name={"Login"} options={{headerShown: false}} component={LoginScreen}/>
79 89
             <Stack.Screen name={"Register"} options={{headerTransparent: true, headerTitle: " "}} component={RegisterScreen}/>
80 90
           </Stack.Navigator>
81 91
         </NavigationContainer>
@@ -85,9 +95,16 @@ export default class App extends Component {
85 95
     return(
86 96
       <Provider store={store}>
87 97
         <NavigationContainer>
98
+<<<<<<< HEAD
88 99
           <Drawer.Navigator>
89 100
             <Drawer.Screen name={" "} options={{drawerLabel: "Home", headerTransparent: true}} children={this.createHomeStack}/>
90 101
           </Drawer.Navigator>
102
+=======
103
+          <Stack.Navigator initialRouteName="Home">
104
+            <Stack.Screen name="Home" component={HomeScreen} />
105
+            <Stack.Screen name="Room" component={RoomScreen} options={({ route }) => ({ title: route.params.thread.name })} />
106
+          </Stack.Navigator>
107
+>>>>>>> devErnesto
91 108
         </NavigationContainer>
92 109
       </Provider>
93 110
     );

+ 137
- 0
package-lock.json View File

@@ -15,6 +15,7 @@
15 15
         "react": "16.13.1",
16 16
         "react-dom": "16.13.1",
17 17
         "react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
18
+        "react-native-gifted-chat": "^0.16.3",
18 19
         "react-native-paper": "^4.9.2",
19 20
         "react-native-web": "~0.13.12",
20 21
         "react-redux": "^7.2.5",
@@ -9304,6 +9305,11 @@
9304 9305
         "react": "16.13.1"
9305 9306
       }
9306 9307
     },
9308
+    "node_modules/react-native-communications": {
9309
+      "version": "2.2.1",
9310
+      "resolved": "https://registry.npmjs.org/react-native-communications/-/react-native-communications-2.2.1.tgz",
9311
+      "integrity": "sha1-eIO1ayCgAu63kMET+GFuqGksp5U="
9312
+    },
9307 9313
     "node_modules/react-native-gesture-handler": {
9308 9314
       "version": "1.10.3",
9309 9315
       "resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-1.10.3.tgz",
@@ -9332,6 +9338,77 @@
9332 9338
         "ua-parser-js": "^0.7.18"
9333 9339
       }
9334 9340
     },
9341
+    "node_modules/react-native-gifted-chat": {
9342
+      "version": "0.16.3",
9343
+      "resolved": "https://registry.npmjs.org/react-native-gifted-chat/-/react-native-gifted-chat-0.16.3.tgz",
9344
+      "integrity": "sha512-7EJKQPzzg1yIbLFNq9n5bGJWZ7Woi2bTeT7M4EVSChmFF/qyNos+gFxEcafPkEihEeIxeOne6hBQlYNKmDABgA==",
9345
+      "dependencies": {
9346
+        "@expo/react-native-action-sheet": "^3.6.0",
9347
+        "dayjs": "^1.8.26",
9348
+        "prop-types": "^15.7.2",
9349
+        "react-native-communications": "^2.2.1",
9350
+        "react-native-iphone-x-helper": "^1.2.1",
9351
+        "react-native-lightbox": "^0.8.1",
9352
+        "react-native-parsed-text": "0.0.22",
9353
+        "react-native-typing-animation": "^0.1.7",
9354
+        "uuid": "3.4.0"
9355
+      },
9356
+      "peerDependencies": {
9357
+        "dayjs": "*",
9358
+        "react": "*",
9359
+        "react-native": "*"
9360
+      }
9361
+    },
9362
+    "node_modules/react-native-gifted-chat/node_modules/@expo/react-native-action-sheet": {
9363
+      "version": "3.12.0",
9364
+      "resolved": "https://registry.npmjs.org/@expo/react-native-action-sheet/-/react-native-action-sheet-3.12.0.tgz",
9365
+      "integrity": "sha512-tuc8mJmDeCc1q/U2q+IJ9pKeIZL/JJoHYBf34Vor1aabfk8m+/LSDlCCi4MVFIU1fHHwgNQyuDbGhsanYPJFRw==",
9366
+      "dependencies": {
9367
+        "@types/hoist-non-react-statics": "^3.3.1",
9368
+        "hoist-non-react-statics": "^3.3.0"
9369
+      },
9370
+      "peerDependencies": {
9371
+        "react": ">=16.3.0"
9372
+      }
9373
+    },
9374
+    "node_modules/react-native-gifted-chat/node_modules/react-native-iphone-x-helper": {
9375
+      "version": "1.3.1",
9376
+      "resolved": "https://registry.npmjs.org/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz",
9377
+      "integrity": "sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==",
9378
+      "peerDependencies": {
9379
+        "react-native": ">=0.42.0"
9380
+      }
9381
+    },
9382
+    "node_modules/react-native-gifted-chat/node_modules/react-native-parsed-text": {
9383
+      "version": "0.0.22",
9384
+      "resolved": "https://registry.npmjs.org/react-native-parsed-text/-/react-native-parsed-text-0.0.22.tgz",
9385
+      "integrity": "sha512-hfD83RDXZf9Fvth3DowR7j65fMnlqM9PpxZBGWkzVcUTFtqe6/yPcIoIAgrJbKn6YmtzkivmhWE2MCE4JKBXrQ==",
9386
+      "dependencies": {
9387
+        "prop-types": "^15.7.x"
9388
+      },
9389
+      "peerDependencies": {
9390
+        "react": "*",
9391
+        "react-native": "*"
9392
+      }
9393
+    },
9394
+    "node_modules/react-native-gifted-chat/node_modules/react-native-typing-animation": {
9395
+      "version": "0.1.7",
9396
+      "resolved": "https://registry.npmjs.org/react-native-typing-animation/-/react-native-typing-animation-0.1.7.tgz",
9397
+      "integrity": "sha512-4H3rF9M+I2yAZpYJcY0Mb29TXkn98QK12rrKSY6LZj1BQD9NNmRZuNXzwX4XHapsIz+N/J8M3p27FOQPbfzqeg==",
9398
+      "peerDependencies": {
9399
+        "prop-types": "*",
9400
+        "react": "*",
9401
+        "react-native": "*"
9402
+      }
9403
+    },
9404
+    "node_modules/react-native-lightbox": {
9405
+      "version": "0.8.1",
9406
+      "resolved": "https://registry.npmjs.org/react-native-lightbox/-/react-native-lightbox-0.8.1.tgz",
9407
+      "integrity": "sha512-TFZA6iKEEHpAUIXjMTRb6vx0/9rHgEKy3ZBiRAy295PwldYg5c8opwnbyURLIl522ykeqhVx9uGdXjSMIowLvA==",
9408
+      "dependencies": {
9409
+        "prop-types": "^15.7.2"
9410
+      }
9411
+    },
9335 9412
     "node_modules/react-native-paper": {
9336 9413
       "version": "4.9.2",
9337 9414
       "resolved": "https://registry.npmjs.org/react-native-paper/-/react-native-paper-4.9.2.tgz",
@@ -19561,6 +19638,11 @@
19561 19638
         }
19562 19639
       }
19563 19640
     },
19641
+    "react-native-communications": {
19642
+      "version": "2.2.1",
19643
+      "resolved": "https://registry.npmjs.org/react-native-communications/-/react-native-communications-2.2.1.tgz",
19644
+      "integrity": "sha1-eIO1ayCgAu63kMET+GFuqGksp5U="
19645
+    },
19564 19646
     "react-native-gesture-handler": {
19565 19647
       "version": "1.10.3",
19566 19648
       "resolved": "https://registry.npmjs.org/react-native-gesture-handler/-/react-native-gesture-handler-1.10.3.tgz",
@@ -19591,6 +19673,61 @@
19591 19673
         }
19592 19674
       }
19593 19675
     },
19676
+    "react-native-gifted-chat": {
19677
+      "version": "0.16.3",
19678
+      "resolved": "https://registry.npmjs.org/react-native-gifted-chat/-/react-native-gifted-chat-0.16.3.tgz",
19679
+      "integrity": "sha512-7EJKQPzzg1yIbLFNq9n5bGJWZ7Woi2bTeT7M4EVSChmFF/qyNos+gFxEcafPkEihEeIxeOne6hBQlYNKmDABgA==",
19680
+      "requires": {
19681
+        "@expo/react-native-action-sheet": "^3.6.0",
19682
+        "dayjs": "^1.8.26",
19683
+        "prop-types": "^15.7.2",
19684
+        "react-native-communications": "^2.2.1",
19685
+        "react-native-iphone-x-helper": "^1.2.1",
19686
+        "react-native-lightbox": "^0.8.1",
19687
+        "react-native-parsed-text": "0.0.22",
19688
+        "react-native-typing-animation": "^0.1.7",
19689
+        "uuid": "3.4.0"
19690
+      },
19691
+      "dependencies": {
19692
+        "@expo/react-native-action-sheet": {
19693
+          "version": "3.12.0",
19694
+          "resolved": "https://registry.npmjs.org/@expo/react-native-action-sheet/-/react-native-action-sheet-3.12.0.tgz",
19695
+          "integrity": "sha512-tuc8mJmDeCc1q/U2q+IJ9pKeIZL/JJoHYBf34Vor1aabfk8m+/LSDlCCi4MVFIU1fHHwgNQyuDbGhsanYPJFRw==",
19696
+          "requires": {
19697
+            "@types/hoist-non-react-statics": "^3.3.1",
19698
+            "hoist-non-react-statics": "^3.3.0"
19699
+          }
19700
+        },
19701
+        "react-native-iphone-x-helper": {
19702
+          "version": "1.3.1",
19703
+          "resolved": "https://registry.npmjs.org/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz",
19704
+          "integrity": "sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg==",
19705
+          "requires": {}
19706
+        },
19707
+        "react-native-parsed-text": {
19708
+          "version": "0.0.22",
19709
+          "resolved": "https://registry.npmjs.org/react-native-parsed-text/-/react-native-parsed-text-0.0.22.tgz",
19710
+          "integrity": "sha512-hfD83RDXZf9Fvth3DowR7j65fMnlqM9PpxZBGWkzVcUTFtqe6/yPcIoIAgrJbKn6YmtzkivmhWE2MCE4JKBXrQ==",
19711
+          "requires": {
19712
+            "prop-types": "^15.7.x"
19713
+          }
19714
+        },
19715
+        "react-native-typing-animation": {
19716
+          "version": "0.1.7",
19717
+          "resolved": "https://registry.npmjs.org/react-native-typing-animation/-/react-native-typing-animation-0.1.7.tgz",
19718
+          "integrity": "sha512-4H3rF9M+I2yAZpYJcY0Mb29TXkn98QK12rrKSY6LZj1BQD9NNmRZuNXzwX4XHapsIz+N/J8M3p27FOQPbfzqeg==",
19719
+          "requires": {}
19720
+        }
19721
+      }
19722
+    },
19723
+    "react-native-lightbox": {
19724
+      "version": "0.8.1",
19725
+      "resolved": "https://registry.npmjs.org/react-native-lightbox/-/react-native-lightbox-0.8.1.tgz",
19726
+      "integrity": "sha512-TFZA6iKEEHpAUIXjMTRb6vx0/9rHgEKy3ZBiRAy295PwldYg5c8opwnbyURLIl522ykeqhVx9uGdXjSMIowLvA==",
19727
+      "requires": {
19728
+        "prop-types": "^15.7.2"
19729
+      }
19730
+    },
19594 19731
     "react-native-paper": {
19595 19732
       "version": "4.9.2",
19596 19733
       "resolved": "https://registry.npmjs.org/react-native-paper/-/react-native-paper-4.9.2.tgz",

+ 1
- 0
package.json View File

@@ -18,6 +18,7 @@
18 18
     "react": "16.13.1",
19 19
     "react-dom": "16.13.1",
20 20
     "react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
21
+    "react-native-gifted-chat": "^0.16.3",
21 22
     "react-native-paper": "^4.9.2",
22 23
     "react-native-web": "~0.13.12",
23 24
     "react-redux": "^7.2.5",

+ 93
- 2
screens/main/Home_page.js View File

@@ -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,12 +8,12 @@ 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'
16 14
 
17 15
 export function Home_page({navigation}) {
16
+<<<<<<< HEAD
18 17
 
19 18
   return (
20 19
     <TouchableWithoutFeedback style={styles.stdcontainer} onPress={Keyboard.dismiss} accessible={false}>
@@ -24,12 +23,101 @@ export function Home_page({navigation}) {
24 23
     </TouchableWithoutFeedback>
25 24
   );
26 25
 }
26
+=======
27
+  const [threads, setThreads] = useState([]);  
28
+  const [loading, setLoading] = useState(true);
29
+  
30
+  const [roomName, setRoomName] = useState('');
31
+
32
+  useEffect(() => {
33
+
34
+    const fire = firebase.firestore()
35
+    .collection('THREADS')
36
+    .where("members", "array-contains", firebase.auth().currentUser.uid)
37
+    .onSnapshot(querySnapshot => {
38
+      const threads = querySnapshot.docs.map(documentSnapshot => {
39
+        return{
40
+          _id:documentSnapshot.id,
41
+          name:'',
42
+          ...documentSnapshot.data()
43
+        };
44
+
45
+      });
46
+
47
+      setThreads(threads);
48
+
49
+      if(loading){
50
+        setLoading(false);
51
+      }
52
+
53
+    });
54
+
55
+    return () => fire();
56
+  }, []);
57
+  
58
+  if (loading) {
59
+    return <Loading />;
60
+  }
61
+
62
+
63
+  function handleButtonPress() {
64
+      firebase.firestore()
65
+        .collection('THREADS')
66
+        .add({
67
+          name: 'PedroFecha',
68
+          members: [
69
+            firebase.auth().currentUser.uid,
70
+            '02yOZHxFcGUX4MNwjeEbAlCShdu1'
71
+          ]
72
+        })
73
+        //.then(() => {
74
+          //navigation.navigate('allChats');
75
+         //});
76
+  }
77
+
78
+  return (
79
+      <ImageBackground style={styles.stdcontainer} source={require('../../assets/yellow-white.jpg')}>
80
+        <FlatList
81
+          data={threads}
82
+          keyExtractor = {item => item._id}
83
+          ItemSeparatorComponent={() => <Divider />}
84
+          renderItem = {({item}) => (
85
+          <TouchableOpacity
86
+            onPress={() => navigation.navigate('Room', {thread: item})}
87
+          >
88
+            <List.Item
89
+              title={item.name}
90
+              titleNumberOfLines={1}
91
+              titleStyle={styles.listTitle}
92
+              descriptionStyle={styles.listDescription}
93
+              descriptionNumberOfLines={1}
94
+            />
95
+          </TouchableOpacity>
96
+        )}
97
+        />
98
+      <Button
99
+        title='Calendario'
100
+        onPress={() => navigation.navigate('Calendar')}
101
+      />  
102
+      <Button
103
+        title='CrearChat'
104
+        onPress={() => handleButtonPress()}
105
+      />
106
+      <Button
107
+        title ='Hacer Busqueda'
108
+        onPress= {() => navigation.navigate('Busqueda')}
109
+      />
110
+        </ImageBackground>
111
+    );
112
+  }
113
+>>>>>>> devErnesto
27 114
 
28 115
 const mapStateToProps = (store) => ({
29 116
   currentUser: store.userState.currentUser
30 117
 })
31 118
 const mapDispatchProps = (dispatch) => bindActionCreators({fetchUser}, dispatch);
32 119
 
120
+<<<<<<< HEAD
33 121
 export default connect(mapStateToProps, mapDispatchProps)(Home_page);
34 122
 const mapStateToProps = (store) => ({
35 123
   currentUser: store.userState.currentUser
@@ -40,3 +128,6 @@ export default connect(mapStateToProps, mapDispatchProps)(Home_page);
40 128
 
41 129
 
42 130
 
131
+=======
132
+export default connect(mapStateToProps, mapDispatchProps)(Home_page);
133
+>>>>>>> devErnesto

+ 4
- 0
screens/main/RoomScreen.js View File

@@ -1,3 +1,7 @@
1
+<<<<<<< HEAD
2
+=======
3
+
4
+>>>>>>> devErnesto
1 5
 import React, { useState, useEffect, useCallback } from 'react';
2 6
 import { GiftedChat } from 'react-native-gifted-chat';
3 7
 import firebase from 'firebase';