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