forked from GabrielKidane/react-native-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
42 lines (33 loc) · 1.38 KB
/
Copy pathApp.js
File metadata and controls
42 lines (33 loc) · 1.38 KB
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
import React from 'react';
import {ApplicationProvider, IconRegistry,} from '@ui-kitten/components';
import {EvaIconsPack} from '@ui-kitten/eva-icons';
import {dark, light, mapping,} from '@eva-design/eva';
import {NavigationContainer} from '@react-navigation/native';
import {SafeAreaProvider} from "react-native-safe-area-context";
import {HomeNavigation} from "./src/navigation/HomeNavigation";
import {ThemeContext} from './ThemeContext';
import {default as appTheme} from './custom-theme.json';
const themes = {light, dark};
const App = () => {
const [theme, setTheme] = React.useState('light');
const currentTheme = {...themes[theme], ...appTheme};
const toggleTheme = () => {
const nextTheme = theme === 'light' ? 'dark' : 'light';
setTheme(nextTheme);
};
return (
<>
<IconRegistry icons={EvaIconsPack}/>
<ThemeContext.Provider value={{theme, toggleTheme}}>
<ApplicationProvider mapping={mapping} theme={currentTheme}>
<SafeAreaProvider>
<NavigationContainer>
<HomeNavigation initialRouteName="Home"/>
</NavigationContainer>
</SafeAreaProvider>
</ApplicationProvider>
</ThemeContext.Provider>
</>
);
};
export default App;