Simpler app container

This commit is contained in:
Diego Mello 2020-05-28 17:34:37 -03:00
parent 7413d26587
commit 1e49d80bb4
1 changed files with 6 additions and 29 deletions

View File

@ -32,7 +32,6 @@ const SetUsernameStack = () => (
); );
// App // App
const Stack = createStackNavigator();
const App = React.memo(({ root }) => { const App = React.memo(({ root }) => {
if (!root || root === ROOT_BACKGROUND) { if (!root || root === ROOT_BACKGROUND) {
return null; return null;
@ -41,34 +40,12 @@ const App = React.memo(({ root }) => {
return ( return (
<SafeAreaProvider initialMetrics={initialWindowMetrics}> <SafeAreaProvider initialMetrics={initialWindowMetrics}>
<NavigationContainer ref={Navigation.navigationRef} onNavigationStateChange={onNavigationStateChange}> <NavigationContainer ref={Navigation.navigationRef} onNavigationStateChange={onNavigationStateChange}>
<Stack.Navigator screenOptions={{ headerShown: false, animationEnabled: false }}> <>
<> {root === ROOT_LOADING ? <AuthLoadingView /> : null}
{root === ROOT_LOADING ? ( {root === ROOT_OUTSIDE || root === ROOT_NEW_SERVER ? <OutsideStack /> : null}
<Stack.Screen {root === ROOT_INSIDE ? <InsideStack /> : null}
name='AuthLoading' {root === ROOT_SET_USERNAME ? <SetUsernameStack /> : null}
component={AuthLoadingView} </>
/>
) : null}
{root === ROOT_OUTSIDE || root === ROOT_NEW_SERVER ? (
<Stack.Screen
name='OutsideStack'
component={OutsideStack}
/>
) : null}
{root === ROOT_INSIDE ? (
<Stack.Screen
name='InsideStack'
component={InsideStack}
/>
) : null}
{root === ROOT_SET_USERNAME ? (
<Stack.Screen
name='SetUsernameStack'
component={SetUsernameStack}
/>
) : null}
</>
</Stack.Navigator>
</NavigationContainer> </NavigationContainer>
</SafeAreaProvider> </SafeAreaProvider>
); );