-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
65 lines (55 loc) · 2.11 KB
/
index.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
/** @format */
import {YellowBox} from "react-native";
import {Navigation} from "react-native-navigation";
import Dashboard from './Components/Dashboard';
import Settings from "./Components/Settings";
// Redux
import {createStore, applyMiddleware} from "redux";
import {reducers} from "./store";
import {persistStore, persistCombineReducers} from "redux-persist";
import storage from "redux-persist/lib/storage";
import { createWhitelistFilter } from 'redux-persist-transform-filter';
import {Provider} from "react-redux";
import thunk from "redux-thunk";
// Ignoring some unusefull warnings
console.ignoredYellowBox = ["Remote debugger"];
YellowBox.ignoreWarnings([
"Unrecognized WebSocket connection option(s) `agent`, `perMessageDeflate`, `pfx`, `key`, `passphrase`, `cert`, `ca`, `ciphers`, `rejectUnauthorized`. Did you mean to put these under `headers`?",
'Require cycle:',
]);
// Store & Persistance
const persistConfig = {
key: 'root',
storage,
transforms: [
createWhitelistFilter('settings', ['apiKey', 'host', 'deviceName', 'debugMode']),
],
version: 1,
};
const persistedReducer = persistCombineReducers(persistConfig, reducers);
const store = createStore(persistedReducer, applyMiddleware(thunk));
Navigation.registerComponentWithRedux(`Dashboard`, () => Dashboard, Provider, store);
Navigation.registerComponentWithRedux(`SettingsScreen`, () => Settings, Provider, store);
Navigation.events().registerAppLaunchedListener(() => {
persistStore(store, null, () => {
Navigation.setRoot({
root: {
stack: {
children: [
{
component: {
options: {
topBar: {
visible: false,
height: 0
}
},
name: "Dashboard"
}
},
]
},
}
});
});
});