-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
71 lines (55 loc) · 1.76 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
import {AppRegistry} from 'react-native'
import {YellowBox} from 'react-native'
import React from "react"
import {createDrawerNavigator, createStackNavigator, createSwitchNavigator} from 'react-navigation'
import {PersistGate} from 'redux-persist/integration/react'
import AddQuote from "./src/screens/addQuote"
import Loading from "./src/screens/loading"
import Quotes from "./src/screens/quotes"
import Login from "./src/screens/login"
import {Provider} from "react-redux"
import {store, persistor} from "./src/store"
import SideMenu from "./src/components/SideMenu"
import FilterModal from "./src/components/FilterModal"
import {BackHandler} from "react-native"
import {modal} from "./src/reducers"
const QuotesNavigator = createStackNavigator({
quotes: {screen: Quotes},
addQuote: {screen: AddQuote},
}, {
mode: 'modal',
headerMode: 'none',
})
const AppNavigator = createDrawerNavigator({
quotes: QuotesNavigator
}, {
contentComponent: SideMenu
})
const RootNavigator = createSwitchNavigator({
loading: {screen: Loading},
login: {screen: Login},
app: AppNavigator
}, {
initialRouteName: 'loading'
})
store.subscribe(() => {
console.log(store.getState())
})
class App extends React.Component {
render() {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<RootNavigator/>
<FilterModal/>
</PersistGate>
</Provider>
)
}
}
BackHandler.addEventListener('hardwareBackPress', function () {
console.log('Back Happened')
store.dispatch({type: modal.MODAL_CLOSE})
})
AppRegistry.registerComponent('MyQuotes', () => App)
YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated'])