-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
127 lines (109 loc) · 3.91 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import { StatusBar } from "expo-status-bar";
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createDrawerNavigator } from "@react-navigation/drawer";
import { DrawerContent } from "./screens/DrawerContent";
import MainTabScreen from "./screens/MainTabScreen";
import RootStackScreen from "./screens/RootStackScreen";
import LoadingPage from "./screens/LoadingPage";
import { AuthSession } from "expo";
import UserStore from "./stores/UserStore";
import { observer } from "mobx-react";
import Main from "./screens/Main";
import Home from "./screens/Home";
import Notifications from "./screens/Notifications";
import OtherProfiles from "./screens/OtherProfiles";
import * as firebase from "firebase";
import { Use } from "react-native-svg";
var firebaseConfig = {
apiKey: "AIzaSyC-Wt2ZiKhqAbBv1coYVW4lJiFpo6FggVA",
authDomain: "projectmelo.firebaseapp.com",
databaseURL: "https://projectmelo.firebaseio.com",
projectId: "projectmelo",
storageBucket: "projectmelo.appspot.com",
messagingSenderId: "1044108628538",
appId: "1:1044108628538:web:863f52f5ce8f544a2adb03",
measurementId: "G-BCHC4MPG0Y",
};
firebase.initializeApp(firebaseConfig);
const notificationsRef = firebase.firestore().collection("notifications");
// const postsRef = firebase.firestore().collection("posts");
const Drawer = createDrawerNavigator();
function App() {
// console.log = function() {}
// React.useEffect(() => {
// notificationsRef.onSnapshot((querySnapShot) => {
// // console.log(querySnapShot, "etrji");
// let items = [];
// querySnapShot.forEach((doc) => {
// items.push(doc.data());
// });
// items.sort(function (a, b) {
// return new Date(b.createdAt) - new Date(a.createdAt);
// });
// UserStore.notifications = items;
// });
// // postsRef.onSnapshot((querySnapShot) => {
// // let items = [];
// // querySnapShot.forEach((doc) => {
// // items.push(doc.data());
// // });
// // items.sort(function (a, b) {
// // return new Date(b.createdAt) - new Date(a.createdAt);
// // });
// // UserStore.allPosts = items;
// // });
// // ref.onCreate((snapshot) => {
// // console.log(snapshot)
// // return db
// // .doc(`/posts/${snapshot.data().postID}`)
// // .get()
// // .then((doc) => {
// // if (doc.exists && doc.data().meloID !== snapshot.data().meloID) {
// // console.log('new notifications')
// // }
// // return;
// // })
// // .catch((err) => {
// // console.error(err);
// // });
// // });
// }, []);
return (
<NavigationContainer>
{UserStore.isLoggedIn === true ? (
UserStore.loading === false ? (
<Drawer.Navigator
drawerContent={(props) => <DrawerContent {...props} />}
>
<Drawer.Screen name="HomeDrawer" component={MainTabScreen} />
<Drawer.Screen name="Home" component={Main} />
<Drawer.Screen name="Notifications" component={Notifications} />
<Drawer.Screen name="Recommendations" component={Home} />
<Drawer.Screen name="Me" component={OtherProfiles} />
{/* <Drawer.Screen name="Settings" component={} />
<Drawer.Screen name="Support" component={MainTabScreen} /> */}
</Drawer.Navigator>
) : (
<Drawer.Navigator
drawerContent={(props) => <DrawerContent {...props} />}
>
<Drawer.Screen name="HomeDrawer" component={LoadingPage} />
</Drawer.Navigator>
)
) : (
<RootStackScreen />
)}
</NavigationContainer>
);
}
export default observer(App);
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});