expo / router

[ARCHIVE]: Expo Router has moved to expo/expo -- The File-based router for universal React Native apps

Home Page:https://docs.expo.dev/routing/introduction/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Navigation between screens in different tabs does not work

janusqa opened this issue · comments

Which package manager are you using? (Yarn is recommended)

npm

Summary

Navigation between screens in different tabs does not work.
Clicking on a link in a screen in one tab does not navigate to a screen in another tab.
When I click on a link on a screen in one tab to go to a screen in another tab it should navigate. It does not.

Minimal reproducible example

https://github.com/janusqa/rn-bare/tree/bug_navigation
npm install
npm start

  1. click on the sign in button
  2. click on the "Go to Tab 2 / Screen 1" link (it should navigate)
  3. click on the first tab
  4. click on the "Go to Tab 2 / Screen 1" link (it no longer works)

Can you please update your repo to be a minimal reproducible example. I cloned your repo and was unable to see a 'Sign in' button. There's also appears to be authentication / loading logic that I'm unsure is related to your issue?

@marklawlor thanks for your feedback.
I've stripped it down to the very basics now I think. The tabs should now load directly.

  1. Click on the Go to Tab2 / Screen 1. It should navigate.
  2. Go back to Tab 1 and click on Go to Tab2 / Screen 1 again. It should no longer work

Note they are three branches on this repo. I am linking to the navigation bug one directly.
https://github.com/janusqa/rn-bare/tree/bug_navigation

@marklawlor this issue seems to have been fixed in 2.0.4.
I forced installed it for the time being "npm install expo-router@latest"

Some dependencies are incompatible with the installed expo version:
  expo-router@2.0.4 - expected version: 2.0.0
Your project may not work correctly until you install the correct versions of the packages.

2.0.4 seems to have fixed the issue I have been having but 2.0.4 produces another error

The `redirect` prop on <Screen /> is deprecated and will be removed. Please use `router.redirect` instead

So I had to revert back to 2.0.0 so I think it is not really a solution.

@janusqa I believe that's a warning, rather than an error. As near as I can tell the line is missing the if (redirect != null) so it'll warn as deprecated regardless of whether the redirect prop is used or not. Harmless warning and you should be able to use 2.0.4, however.

"The `redirect` prop on <Screen /> is deprecated and will be removed. Please use `router.redirect` instead",

Submitted #873 to fix the confusing warning.

Those are just warnings, its fine to upgrade to 2.0.4. The deprecated message will be removed in 2.0.5

@marklawlor @austin43, thank you.
Note that the deprecated warning is still present in 2.0.5

On second look I am now getting this error
" The action 'REPLACE' with payload {"name":"queue"} was not handled by any navigator."
I will update the repo above and try it there.

I have updated the repo to demonstrate the issue.
On "Tab 1 / Screen 1" click "Go to Tab 2 / Screen 1"
On that screen click on "Tab 2 / screen 1"
Go back to Tab 1 / Screen 1" and click "Go to Tab 2 / Screen 1"
The error should appear.
" The action 'REPLACE' with payload {"name":"tab2"} was not handled by any navigator."

It seems to occur when in the second tab the screen at the top of the stack is any other screen but the initial screen of that stack.