This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
91 lines (83 loc) · 2.95 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import "expo-dev-client";
import { useDeviceContext } from "twrnc";
import tw from "./src/tailwind";
import Main from "./src/screens/Main";
import { useFonts } from "@expo-google-fonts/nunito";
import { NavigationContainer } from "@react-navigation/native";
import Stack from "./src/navigation/Stack";
import Play from "./src/screens/Play";
import Settings from "./src/screens/Settings";
import Error from "./src/screens/Error";
import { gestureHandlerRootHOC } from "react-native-gesture-handler";
import * as SplashScreen from "expo-splash-screen";
import React from "react";
import { SettingsProvider } from "./src/contexts/settings";
import { Provider } from "react-redux";
import { store } from "./src/state/store";
import { MidiProvider } from "./src/contexts/midi";
import { RoomProvider } from "./src/contexts/room";
import { PlayerProvider } from "./src/contexts/player";
import { LogBox } from "react-native";
import { fonts, iceServers, urls } from "./src/constants";
LogBox.ignoreLogs([
"`new NativeEventEmitter()`",
"EventEmitter.removeListener",
]);
const mainScreen = gestureHandlerRootHOC(Main);
const playScreen = gestureHandlerRootHOC(Play);
const settingsScreen = gestureHandlerRootHOC(Settings);
const errorScreen = gestureHandlerRootHOC(Error);
export default function App() {
useDeviceContext(tw);
const [fontsLoaded] = useFonts(fonts);
const onLayoutReady = React.useCallback(
async () => await SplashScreen.hideAsync(),
[]
);
React.useEffect(() => {
SplashScreen.preventAutoHideAsync().then();
}, []);
if (!fontsLoaded) return null;
return (
<NavigationContainer onReady={onLayoutReady}>
<Provider store={store}>
<SettingsProvider>
<MidiProvider>
<RoomProvider url={urls.connect} iceServers={iceServers}>
<PlayerProvider>
<Stack.Navigator
initialRouteName="main"
screenOptions={{
headerShown: false,
statusBarHidden: true,
}}
>
<Stack.Screen
name="main"
component={mainScreen}
options={{ orientation: "default" }}
/>
<Stack.Screen
name="play"
component={playScreen}
options={{ orientation: "landscape" }}
/>
<Stack.Screen
name="settings"
component={settingsScreen}
options={{ orientation: "default" }}
/>
<Stack.Screen
name="error"
component={errorScreen}
options={{ orientation: "default" }}
/>
</Stack.Navigator>
</PlayerProvider>
</RoomProvider>
</MidiProvider>
</SettingsProvider>
</Provider>
</NavigationContainer>
);
}