i just updated from sdk 51 to sdk52 on my expo react native app.
Before the update i was trying to push in a route with according params like this:
onPress={() => router.push(
../routes/workoutDetail?id=${workout.id})}
But now the parameter im trying to access in the workoutDetail is undefined
useEffect(() => {
const workoutId = route.params?.id;
if (workoutId) {
fetchWorkoutDetails(workoutId);
}
}, [route.params?.id]);
I tried getting the parameters like this aswell:
const params = useLocalSearchParams();
const { id = } = params;
but nothing works
I would appreciate any help π
2
Answers
Have you tried passing the parameter like this?
Also, using ../routes may not be the best approach for defining the pathname. Itβs better to use the global namespace"
This problem was solved when I upgraded to Expo v52.0.7 and ran npx expo install –fix again.
I think that the original update did not update @react-navigation/native from ^6.x to ^7.0.0, and this was fixed.