-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
25 lines (22 loc) · 748 Bytes
/
App.js
File metadata and controls
25 lines (22 loc) · 748 Bytes
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
import React, { useState } from "react";
import { ApplicationProvider } from "react-native-ui-kitten";
import { mapping } from "@eva-design/eva";
import AppNavigator from "./src/navigation/AppNavigator";
import themes, { themeNames } from "./src/constants/Themes";
const App = () => {
// Default vars
const light = themeNames[0];
const dark = themeNames[1];
const [theme, setTheme] = useState(light);
// toggles between light or dark theme
const toggleTheme = () => {
const nextTheme = theme === light ? dark : light;
setTheme(nextTheme);
};
return (
<ApplicationProvider mapping={mapping} theme={themes[theme]}>
<AppNavigator toggleTheme={toggleTheme} />
</ApplicationProvider>
);
};
export default App;