-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
50 lines (44 loc) · 1.61 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
import 'react-native-gesture-handler';
import React, { useMemo } from 'react';
import { AppRegistry, LogBox } from 'react-native';
import { Provider } from 'react-redux';
import App from './src/App';
import { name as appName } from './app.json';
import { OnDiskRealmProvider, InMemoryRealmProvider } from '~Storage/Realm';
import { store } from '~Storage/Redux';
import { NavigationContainer } from '@react-navigation/native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { useColorScheme, useTheme } from '~Utils';
// const { RealmProvider } = realmContext;
LogBox.ignoreLogs(['The native module for Flipper', 'ViewPropTypes']);
const getTheme = (scheme, colorTheme) => {
const theme = {
colors: {
background: scheme === 'dark' ? colorTheme.dark : colorTheme.light,
border: scheme === 'dark' ? colorTheme.dark : colorTheme.light,
},
};
return theme;
};
const Main = () => {
const scheme = useColorScheme();
const theme = useTheme();
const colorScheme = useMemo(
() => getTheme(scheme, theme.constants),
[scheme, theme],
);
return (
<Provider store={store}>
<NavigationContainer theme={colorScheme}>
<OnDiskRealmProvider>
<InMemoryRealmProvider>
<SafeAreaProvider>
<App />
</SafeAreaProvider>
</InMemoryRealmProvider>
</OnDiskRealmProvider>
</NavigationContainer>
</Provider>
);
};
AppRegistry.registerComponent(appName, () => Main);