I upgraded my expo react native app from expo sdk 51 to sdk 52 Fixed some minor errors but one came up and I cannot find the solution anywhere.
<NavigationContainer>
<Stack.Navigator
initialRouteName={
storedCredentials ? "ErrandLandingScreen" : "OnboardingScreen"
}
screenOptions={({ navigation }) => ({
headerShown: false,
headerShadowVisible: false,
headerTitle: "",
headerTitleAlign: "center",
headerStyle: {
backgroundColor: colors.white,
paddingHorizontal: 20,
},
animation: "fade",
headerLeft: (props) => (
<TouchableOpacity
{...props}
onPress={() => navigation.goBack()}
>
<Ionicons name="chevron-back-outline" size={23} />
</TouchableOpacity>
),
})}
>
//screens go here
</Stack.Navigator>
</NavigationContainer>
Above is my code. But the navigation.goBack() is not working again after the upgrade. Please help
I upgraded my expo react native app from expo sdk 51 to sdk 52 Fixed some minor errors but one came up and I cannot find the solution anywhere.
<NavigationContainer>
<Stack.Navigator
initialRouteName={
storedCredentials ? "ErrandLandingScreen" : "OnboardingScreen"
}
screenOptions={({ navigation }) => ({
headerShown: false,
headerShadowVisible: false,
headerTitle: "",
headerTitleAlign: "center",
headerStyle: {
backgroundColor: colors.white,
paddingHorizontal: 20,
},
animation: "fade",
headerLeft: (props) => (
<TouchableOpacity
{...props}
onPress={() => navigation.goBack()}
>
<Ionicons name="chevron-back-outline" size={23} />
</TouchableOpacity>
),
})}
>
//screens go here
</Stack.Navigator>
</NavigationContainer>
Above is my code. But the navigation.goBack() is not working again after the upgrade. Please help
Share Improve this question asked Nov 16, 2024 at 8:48 ReoReo 1232 silver badges10 bronze badges 3- Actually it turns out the headerleft or headerright just isn't clickable again That is why it does not work – Reo Commented Nov 16, 2024 at 18:06
- Do you know how to fix the header not clickable problem? – user2054522 Commented Dec 5, 2024 at 8:21
- headerLeft and headerRight is clickable, but it does not work. github/expo/expo/issues/32927 – user2573099 Commented Dec 6, 2024 at 4:11
1 Answer
Reset to default 0Try using router.back() instead
import {router} from "expo-router";
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745662385a4638915.html
评论列表(0条)