React-native-router-flux: No route defined for key with type: ActionConst.RESET

Created on 19 Dec 2017  ·  18Comments  ·  Source: aksonov/react-native-router-flux

  • react-native-router-flux - 4.0.0-beta.24
  • react-native 0.49.5

Actions.xyz({type: ActionConst.RESET});
_Error: There is no route defined for key xyz. Must be one of ......._

But Actions.xyz(); is working fine

Unable to understand whats the issue here. Can someone please help.

needs response from author

Most helpful comment

Why is this closed as this bug is definitely outstanding?

All 18 comments

Try using ActionConst.REPLACE instead of ActionConst.RESET. #2189

@Anandks1993 But ActionConst.REPLACE will only replace the current screen, right?

But my requirement is to reset the whole route stack.

Yeah you are right, it seems react-navigation's reset is not working well here, you can try push_or_pop and if possible look at 2189 issue you may get solution there. 😃

I have the same issue when trying setup a Drawer component.

<Scene key="drawer" type={ActionConst.REPLACE} component={NavigationDrawer} open={false} > <Scene key="home" component={RecordsListScreen} title="Records" /> </Scene>

Error: There is no route defined for key home. Must be one of: 'load','login','register','drawer','record'

Not sure but looks related

Can someone guide how this issue can be solved? Would love to contribute

You need to write own processing of this action within Reducer.js, because now react navigation is used and it is buggy - works only for root sub scenes

22 дек. 2017 г., в 9:37, ANUSHEEL SINGH notifications@github.com написал(а):

Can someone guide how this issue can be solved? Would love to contribute


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Closing it for now. PR is welcome.

Why is this closed as this bug is definitely outstanding?

I acknowledge this issue is closed, but I wanted to chime in here too. I tried implementing the drawer to divide up routes/screens that should be available as an unauthenticated and authenticated user, but came across this same error. I'm sure there is a technical problem with my setup that caused this. I hope with React Navigation's 1.0 release and stabilization of their feature set make this possible to revisit and possibly fix in the near future.

Thanks again.

Same thing - { type: 'reset' } is not working. It works until I wrap all into the Modal scene.
Update
I think this is because you could reset only in scope of some root. By using modal I started to place scenes out of root scope so it is not work as expected.

I'm running into this.

edit: for some reason, <Scene drawer> works.

@busheezy would you mind to share your code ? because i running into the same problem also. Thanks

oh, I'm sorry. I didn't have my comment formatted correctly and my code was invisible. I used <Scene drawer> instead of <Drawer>, I believe.

Still getting the same error

same error

@gitsuraj Please share your code. It is better to modify Example accordingly to demonstrate the issue.

Closing it, feel free to reopen after providing an Example. I've totally re-worked 'replace' action, so it should work now for arbitrary nodes, including stacks. I'm not sure why we need 'reset' now.

I know I'm a little late to the party. 🤷‍♂ :)

In v3, you could use route('subscene2', { type: ActionConst.RESET }) from anywhere in the app and it did what you'd expect it to do - Reset the nav stack within that scene's scope, which means there'd be no back button and nothing to go back to.

In v4 it works a little differently. Let's say this is my scene setup:

<Scene key="root">
  <Scene key="home" /> 
  <Scene>
    <Scene key="subscene1" /> 
    <Scene key="subscene2" /> 
  </Scene>
</Scene>

Routing to a top-level is going to work from anywhere inside the app:

route('home', { type: ActionConst.RESET })

You can alsoRESET if you're coming from a scene within the same scope. So the following code would work from subscene1, but would break if you tried to do it from home:

route('subscene2', { type: ActionConst.RESET })

For my specific use case, it was fine to use <Scene key="subscene1" hideBackImage /> instead of RESET. But as far as I can tell, that's only useful if that scene should NEVER have a back button. If you want to selectively reset the nav stack based on where you're routing from, I think you're out of luck.

Edit: Even without a back button, you can still swipe back. 🤦‍♂

@aksonov I don't know if it's easy to bring it back, but V3 functionality was really nice. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sylvainbaronnet picture sylvainbaronnet  ·  3Comments

willmcclellan picture willmcclellan  ·  3Comments

rafaelcorreiapoli picture rafaelcorreiapoli  ·  3Comments

xnog picture xnog  ·  3Comments

basdvries picture basdvries  ·  3Comments