-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
App.js
68 lines (62 loc) · 2.27 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
62
63
64
65
66
67
68
// import { StatusBar } from "expo-status-bar";
import "react-native-gesture-handler";
import React from "react";
import BottomNavigation from "./navigation/BottomNavigation";
import {
NavigationContainer,
DarkTheme as NavigationDarkTheme,
DefaultTheme as NavigationDefaultTheme,
} from "@react-navigation/native";
import {
DarkTheme as PaperDarkTheme,
DefaultTheme as PaperDefaultTheme,
Provider as PaperProvider,
} from "react-native-paper";
import merge from "deepmerge";
import { PreferencesContext } from "./shared/PreferencesContext";
import Snack from "./shared/Snack";
import Admin from "./screens/Admin/Admin";
import TeacherDashboard from "./screens/TeacherDash/TeacherDashboard";
import StudentDashboard from "./screens/StudentDash/StudentDashboard";
const CombinedDefaultTheme = merge(PaperDefaultTheme, NavigationDefaultTheme);
PaperDarkTheme.colors.onBackground = "rgb(68, 68, 68)";
const CombinedDarkTheme = merge(PaperDarkTheme, NavigationDarkTheme);
export default function App() {
const [isThemeDark, setIsThemeDark] = React.useState(false);
const [SnackMessage, setSnackMessage] = React.useState("This is a message");
const [visible, setVisible] = React.useState(true);
const onDismissSnackBar = () => setVisible(false);
let theme = isThemeDark ? CombinedDarkTheme : CombinedDefaultTheme;
console.log("THEMEMEME", theme);
const newTHeme = { ...theme, colors: { ...theme.colors, primary: "#672dd8" } };
const toggleTheme = React.useCallback(() => {
return setIsThemeDark(!isThemeDark);
}, [isThemeDark]);
const preferences = React.useMemo(
() => ({
toggleTheme,
isThemeDark,
}),
[toggleTheme, isThemeDark]
);
return (
<PreferencesContext.Provider value={preferences}>
<PaperProvider theme={newTHeme}>
<NavigationContainer theme={newTHeme}>
<StudentDashboard />
{/* <TeacherDashboard/> */}
{/* <Admin/> */}
{/* <BottomNavigation
setSnackMessage={setSnackMessage}
setVisible={setVisible}
/> */}
{/* <Snack
message={SnackMessage}
visible={visible}
onDismissSnackBar={onDismissSnackBar}
/> */}
</NavigationContainer>
</PaperProvider>
</PreferencesContext.Provider>
);
}