This repository has been archived by the owner on Mar 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
61 lines (48 loc) · 1.44 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
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import { Orientation } from 'react-native-orientation';
import { BackHandler } from 'react-native';
import DeviceInfo from 'react-native-device-info';
import { Localization } from './src/i18n';
import App from './src/App';
import appReducer from './src/reducers';
import gameMiddleware from './src/reducers/appMiddleware';
import {
navigateToPage,
setLang,
} from './src/actions';
import { Logger } from './src/Helper';
let store = createStore(
appReducer,
applyMiddleware(gameMiddleware)
);
// store.dispatch(setLang(Localization.guesLang(DeviceInfo.getDeviceLocale()))); // after eject (should work ?)
// store.dispatch(setLang(Localization.guesLang('pl-PL')));
class Application extends Component {
componentDidMount() {
// Orientation.lockToPortrait(); // uncoment after eject AND SET UP
}
render() {
return (
<Provider store={store}>
<App />
</Provider>
);
}
}
BackHandler.addEventListener('hardwareBackPress', function() {
// Logger.dumpLog(store.getState().nav.routes, 8);
let index = store.getState().nav.routes[0].index;
switch(index) {
case 3:
store.dispatch(navigateToPage('ds.settings'));
return true;
}
if (index > 0) {
store.dispatch(navigateToPage('ds.home'));
return true;
}
return false;
});
export default Application;