-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
56 lines (48 loc) · 1.53 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
import "react-native-gesture-handler";
import * as React from "react";
import store from "./redux/store";
import { Provider } from "react-redux";
import firebase from "firebase";
import { firebaseConfig } from "./firebaseConfig";
import { ReactReduxFirebaseProvider } from "react-redux-firebase";
import { createFirestoreInstance } from "redux-firestore";
firebase.initializeApp(firebaseConfig);
// Initialize other services on firebase instance
firebase.firestore(); // <- needed if using firestore
import { ApplicationProvider } from "@ui-kitten/components";
import * as eva from "@eva-design/eva";
import Main from "./Main";
// react-redux-firebase config
const reactReduxFirebaseConfig = {
userProfile: "users",
useFirestoreForProfile: true, // Firestore for Profile instead of Realtime DB
};
// react-redux-firebase props
const reactReduxFirebaseProps = {
firebase,
config: reactReduxFirebaseConfig,
dispatch: store.dispatch,
createFirestoreInstance, // <- needed if using firestore
};
const checkIfLoggedIn = () => {
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
//props.navigation.navigate("Main");
loggedIn = true;
console.log("logged In");
} else {
loggedIn = false;
}
});
};
export default function App() {
return (
<Provider store={store}>
<ReactReduxFirebaseProvider {...reactReduxFirebaseProps}>
<ApplicationProvider {...eva} theme={eva.light}>
<Main />
</ApplicationProvider>
</ReactReduxFirebaseProvider>
</Provider>
);
}