Search code examples
reactjs-fluxreact-native-router-flux

How to pass props to Actions.replace react-native-router-flux


Version Tell us which versions you are using:

react-native-router-flux v4.0.0-beta.28
react-native v0.52.2

Tried the following...

Actions.replace({ key: tabKey, props: tabPage }); Actions[key]({ type: ActionConst.REPLACE, tabPage: tabPage })

and several variations there of


Solution

  • I would recommend to try the most recent version - but if that's not possible, move to the last beta that was still using react-navigation 1.5 - there is a branch for that version only now (4.0.0-beta) and then use the execute method.

    Actions.execute('replace', tabKey, { tabPage });
    

    And I believe the two examples you showed are not correct too, but I might be wrong, the number of changes during the work in this beta version was huge, but according to the code/API docs, this is the way you were supposed to be doing it:

    Actions.replace(tabKey, { tabPage });
    
    // or 
    
    Actions[tabKey]({ tabPage }); // and use type={ActionsConst.REPLACE} on your `Scene`