Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Fixed unnecessary screen rerenders (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
spietras authored May 20, 2022
1 parent 9362c45 commit 8a929dd
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ function configureLogging() {
]);
}

const mainScreen = gestureHandlerRootHOC(Main);
const playScreen = gestureHandlerRootHOC(Play);
const settingsScreen = gestureHandlerRootHOC(Settings);

export default function App() {
useDeviceContext(tw);

Expand All @@ -79,12 +83,12 @@ export default function App() {
if (!fontsLoaded) return null;

return (
<Provider store={store}>
<SettingsProvider>
<MidiProvider>
<RoomProvider>
<PlayerProvider>
<NavigationContainer onReady={onLayoutReady}>
<NavigationContainer onReady={onLayoutReady}>
<Provider store={store}>
<SettingsProvider>
<MidiProvider>
<RoomProvider url={serverUrl}>
<PlayerProvider>
<Stack.Navigator
initialRouteName="main"
screenOptions={{
Expand All @@ -94,26 +98,26 @@ export default function App() {
>
<Stack.Screen
name="main"
component={gestureHandlerRootHOC(Main)}
component={mainScreen}
initialParams={{ availableEmojiCodes: availableEmojiCodes }}
options={{ orientation: "default" }}
/>
<Stack.Screen
name="play"
component={gestureHandlerRootHOC(Play)}
component={playScreen}
options={{ orientation: "landscape" }}
/>
<Stack.Screen
name="settings"
component={gestureHandlerRootHOC(Settings)}
component={settingsScreen}
options={{ orientation: "default" }}
/>
</Stack.Navigator>
</NavigationContainer>
</PlayerProvider>
</RoomProvider>
</MidiProvider>
</SettingsProvider>
</Provider>
</PlayerProvider>
</RoomProvider>
</MidiProvider>
</SettingsProvider>
</Provider>
</NavigationContainer>
);
}

0 comments on commit 8a929dd

Please sign in to comment.