admin管理员组文章数量:1026989
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";
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";
本文标签: react nativenavigationgoBack() not working in expo 52Stack Overflow
版权声明:本文标题:react native - navigation.goBack() not working in expo 52 - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745662383a2161969.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论