React navigation goBack() and update parent state

You can pass a callback function as parameter when you call navigate like this: const DEMO_TOKEN = await AsyncStorage.getItem(‘id_token’); if (DEMO_TOKEN === null) { this.props.navigation.navigate(‘Login’, { onGoBack: () => this.refresh(), }); return -3; } else { this.doSomething(); } And define your callback function: refresh() { this.doSomething(); } Then in the login/registration view, before goBack, you … Read more

Hide header in stack navigator React navigation

UPDATE as of version 5 As of version 5 it is the option headerShown in screenOptions Example of usage: <Stack.Navigator screenOptions={{ headerShown: false }} > <Stack.Screen name=”route-name” component={ScreenComponent} /> </Stack.Navigator> If you want only to hide the header on 1 screen you can do this by setting the screenOptions on the screen component see below … Read more