forked from synonymdev/bitkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Root.tsx
44 lines (36 loc) · 1.05 KB
/
Root.tsx
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
import React, { ReactElement } from 'react';
import { View, StyleSheet } from 'react-native';
import { PersistGate } from 'redux-persist/integration/react';
import { enableScreens, enableFreeze } from 'react-native-screens';
import { Provider } from 'react-redux';
import { EventEmitter } from 'events';
import nodejs from 'nodejs-mobile-react-native';
import App from './src/App';
import ErrorBoundary from './src/ErrorBoundary';
import store, { persistor } from './src/store';
EventEmitter.defaultMaxListeners = 1000; // default is 10, but we need to listen a lot of address
nodejs.start('main.js');
enableScreens(true);
enableFreeze(true);
const Root = (): ReactElement => {
const content = (
<Provider store={store}>
<PersistGate
loading={<View style={styles.container} />}
persistor={persistor}>
<App />
</PersistGate>
</Provider>
);
if (__DEV__) {
return content;
}
return <ErrorBoundary>{content}</ErrorBoundary>;
};
export default Root;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'black',
},
});