Skip to content

Instantly share code, notes, and snippets.

@vadiraja
Created March 18, 2020 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vadiraja/77b150e11d296b34bde72418a273a720 to your computer and use it in GitHub Desktop.
Save vadiraja/77b150e11d296b34bde72418a273a720 to your computer and use it in GitHub Desktop.
Load screens based on user auth status
<NavigationContainer>
<Stack.Navigator
headerMode="screen"
screenOptions={{
headerTintColor: 'white',
headerStyle: styles.header,
}}
>
{this.state.isLoggedIn ? (
<>
<Stack.Screen name="Main" component={MainNavigator}
options={{
headerShown:true,
// title: 'My home',
headerRight: () => (
<View>
<Button onPress={() => Auth.signOut({ global: true })} transparent>
<Icon type="FontAwesome" name="sign-out" style={{color: 'white'}}/>
</Button>
</View>
)
}}
/>
</>
) : (
<>
<Stack.Screen name="Amplify Test" component={AuthTabs}
options={{
headerShown:true
}}
/>
</>
)}
</Stack.Navigator>
</NavigationContainer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment