I am using expo-router, I have two screens ScreenA and ScreenB, from ScreenA I am navigating to screenB, in screenB I want to push data back to screenA by using router.back()
or any other way, I don’t want to use router.push()
since I want to go back not push the previous screen on top of the stack, Is there any way to pass params while navigating back in expo-router
Here is the root layout:
<Stack>
<Stack.Screen
name="index"
/>
<Stack.Screen
name="admin/screenA"
/>
</Stack>
Here is how I am navigating to screenB:
router.push({
pathname: './screenB',
params: location
? {
latitude: location.latitude,
longitude: location.longitude,
}: null,});
I am using useLocalSearchParams() to access params in both screens