I couldn't find anywhere in the docs that explain what these do. When a user opens the app by clicking on a scheme url for the app I want the app to go back to the main page. How do I do that? I tried Actions.Main({type: ActionConst.POP_TO});
thinking it would pop till it found Main
but it threw an error so I settled on Actions.Main({type: ActionConst.RESET});
but I'm not really sure what that's doing (although it works).
Is there a good explanation of what these do and when to use them?
| Property | Type | Value | Shorthand |
| --- | --- | --- | --- |
| ActionConst.JUMP | string
| 'REACT_NATIVE_ROUTER_FLUX_JUMP' | 'jump' |
| ActionConst.PUSH | string
| 'REACT_NATIVE_ROUTER_FLUX_PUSH' | 'push' |
| ActionConst.REPLACE | string
| 'REACT_NATIVE_ROUTER_FLUX_REPLACE' | 'replace' |
| ActionConst.BACK | string
| 'REACT_NATIVE_ROUTER_FLUX_BACK' | 'back' |
| ActionConst.BACK_ACTION | string
| 'REACT_NATIVE_ROUTER_FLUX_BACK_ACTION' | 'BackAction' |
| ActionConst.POP_TO | string
| 'REACT_NATIVE_ROUTER_FLUX_POP_TO' | 'popTo' |
| ActionConst.REFRESH | string
| 'REACT_NATIVE_ROUTER_FLUX_REFRESH' | 'refresh' |
| ActionConst.RESET | string
| 'REACT_NATIVE_ROUTER_FLUX_RESET' | 'reset' |
| ActionConst.FOCUS | string
| 'REACT_NATIVE_ROUTER_FLUX_FOCUS' | 'focus' |
it's just a bunch of constants represent real values of various actions to avoid future changes.
you can treat it like redux action.
This can use directly for example Actions.pop()
will dispatch correspond action written in the source code, or, you can set those constants in scene type, when you do Actions.main()
, it will dispatch action according to your scene type
or the default one.
But not every ActionConst can be used the same way ( use as an action or whether it can be set in scene type
or not), that's why I said it's just a bunch of constants to mask the actual values.
about your question, it really depends on your route architecture
, for the simplest way I can tell would be: Actions.main();
if you don't bother route stacks.
set type='ActionConst.REPLACE' in Main Scene, will also jump to it but with route stack be replaced.
@aksonov I think u can close this