-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.tsx
executable file
·70 lines (60 loc) · 2.54 KB
/
App.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import React, { useEffect } from "react";
import { Platform, StatusBar } from "react-native";
import AppLoading from "expo-app-loading";
import { NavigationContainer } from "@react-navigation/native";
import { AppNavigator } from "./navigators/AppNavigator";
import { useFonts, Rubik_300Light, Rubik_400Regular, Rubik_500Medium } from "@expo-google-fonts/rubik";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { ErrorBoundary } from "./components/ErrorBoundary";
import { theme } from "./theme";
import { WelcomeScreen } from "./screens/WelcomeScreen";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { AppScreenParamsList } from "./types";
import { MacAddressScreen } from "./screens/MacAddressScreen";
import { OptionsMenuScreen } from "./screens/OptionsMenuScreen";
import { SettingsScreen } from "./screens/SettingsScreen";
import { AuthTokenScreen } from "./screens/AuthTokenScreen";
const { Navigator, Screen } = createNativeStackNavigator<AppScreenParamsList>();
function MainNavigator() {
const headerTintColor = theme.text;
const headerTitleStyle = {
fontFamily: theme.fonts.title,
};
return (
<Navigator initialRouteName="DebugWelcome">
<Screen name="DebugWelcome" component={WelcomeScreen} options={{ headerShown: false }} />
<Screen name="DebugMacAddress" component={MacAddressScreen} options={{ animation: "none", headerShown: false }} />
<Screen name="AppNavigator" component={AppNavigator} options={{ animation: "none", headerShown: false }} />
<Screen name="Options" component={OptionsMenuScreen} />
<Screen name="SettingsScreen" component={SettingsScreen} options={{ headerTintColor, headerTitleStyle }} />
<Screen name="AuthTokenScreen" component={AuthTokenScreen} options={{ headerTintColor, headerTitleStyle }} />
</Navigator>
);
}
export default function App() {
const [fontsLoaded] = useFonts({
Rubik_300Light,
Rubik_400Regular,
Rubik_500Medium,
});
// console.log("process.env.NODE_ENV: ", process.env.NODE_ENV);
useEffect(() => {
StatusBar.setBarStyle("dark-content");
if (Platform.OS === "android") {
StatusBar.setBackgroundColor(theme.background);
}
});
if (!fontsLoaded) {
return <AppLoading />;
} else {
return (
<ErrorBoundary>
<SafeAreaProvider>
<NavigationContainer>
<MainNavigator />
</NavigationContainer>
</SafeAreaProvider>
</ErrorBoundary>
);
}
}