Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue popping down to root StackNavigator #1987

Closed
alexchia opened this issue Jul 8, 2017 · 6 comments
Closed

Issue popping down to root StackNavigator #1987

alexchia opened this issue Jul 8, 2017 · 6 comments

Comments

@alexchia
Copy link

alexchia commented Jul 8, 2017

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta5

In a project that is set up like this:

<Scene key='root'> <Scene key='login'> <Scene key='main' tabs> <Scene key='tab1'> <Scene key='settings1'> <Scene key='settings2'> </Scene> <Scene key='tab2'> ...

Assume that right now we are on tab1, and that stacknavigator has ['settings1', 'settings2'] where settings2 is at the top.

From the Settings2 scene, it seems to be extremely difficult, if not possible to pop down to the scene 'login'.

Actions.login() does not work (an undefined error pops up)

The hack
Actions.reset('login') doesn't even work, and
we only get options available in the current stackNavigator.
(Error: there is no route defined for key 'login', Must be one of 'tab1', 'settings1', 'settings2')

Furthermore, the Actions.popTo() function from v3 seems to have been removed.
The example in v4 still has code that uses this inexistent function.

--

I think this issue is stemming from
when a project is set up as StackNavigator 1 > TabNavigator > StackNavigator 2,
scenes in Stacknavigator 2 are unable to pop us back down to StackNavigator 1.

Right now without a popTo function, there seems to be no way to do so in the current framework.

@alexchia alexchia changed the title Issue popping to main Issue popping down to root StackNavigator Jul 8, 2017
@aksonov
Copy link
Owner

aksonov commented Jul 8, 2017

Could you fork and modify Example to show what exactly do you want to achieve?
Is it similar to your issue
react-navigation/react-navigation#1593 ?

If so, probably I have to add popTo method that will use back({key:routeName}) - if it is really supported by RN

@alexchia
Copy link
Author

alexchia commented Jul 8, 2017

thanks!

please check out:
https://github.com/alexchia/react-native-router-flux

Only changes are in Example/components/TabView.js

To replicate,
Go to TabBar page>next screen for tab2_1>Logout and back to Launch screen

At tab2_2, there doesn't seem to be any way to pop back to the Launch screen.
Can't even hack my way back there.
Doing Actions.launch() would be incorrect there because it would push Launch instead of popping down back to launch.

@aksonov aksonov mentioned this issue Jul 10, 2017
aksonov pushed a commit that referenced this issue Jul 10, 2017
@aksonov
Copy link
Owner

aksonov commented Jul 10, 2017

Please check latest master

@alexchia
Copy link
Author

@aksonov thanks for so quickly pushing a fix!

could you deploy it to npm so I can test it with the complex Scene hierarchy I have in my app right now?

@aksonov
Copy link
Owner

aksonov commented Jul 10, 2017 via email

@alexchia
Copy link
Author

works great in beta7. amazing work!
thanks @aksonov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants