react-navigation / rfcs

RFCs for changes to React Navigation
Other
88 stars 16 forks source link

Reset state action #70

Open brentvatne opened 5 years ago

brentvatne commented 5 years ago

Reset as a way to dispatch actions is a bit clunky. If we just let people reset the state to exactly what they want, that seems both more powerful and easier to use. For example, see: https://github.com/react-navigation/react-navigation/issues/5338

brentvatne commented 5 years ago

I think we should expose an action called dangerouslyResetState that allows users to have full control over what the state will be set to. The reason we would want to include 'dangerously' in the name is because you should be sure that you need to do this, you are directly manipulating the state of the router and if you make a mistake it could cause your app to crash or something.

brentvatne commented 5 years ago

example of something similar using getStateForAction https://snack.expo.io/@notbrent/reset-state