React-native-router-flux: Actions.key is not working

Created on 25 Oct 2017  路  10Comments  路  Source: aksonov/react-native-router-flux

Version

Tell us which versions you are using:
4.0.0-beta.22

  • react-native-router-flux v4.0.0-beta.22
  • react-native v0.49.3

Expected behaviour

I have my scenes set up like this:

const scenes = Actions.create(
    <Modal key="root">
      <Scene key='Loading'
          component={Loading}
          title="Loading"/>
      <Scene key='HomeScene'
              component={MainView}
              title="APP"/>
        <Scene key='Detailed'
            component={DetailedItemScene}
            title="APP"/>
      </Modal>
)

class App extends Component{
render()
  {
    const { status, user, loggingIn} = this.props;
    return(<Router  scenes={scenes}/>)
  }
}

Then when I try to call
Actions.Detailed()
or
Actions.HomeScene()

It just doesn't work at all. Nothing happens.

I can never get it to go away from the initial screen.

The exact same code worked in v3, but if I want to update my react native version, v3 no longer works

Most helpful comment

same issue.. any updates on this?

All 10 comments

Try to put a Stack or a Scene over Modal:

<Scene key ='root' >
    <Modal key='modal'>
      [...]
    </Modal>
</Scene>

I've tried it with Scene, and Stack and nothing changes.

What about the <Overlay />?

It happens because you created scenes wrong. You should try something like this:

<Router>
  <Modal>
    <Stack>
      // here is your scenes with initial
    </Stack>
    // here is your modals
  </Modal>
</Router>

Sorry the Modal was not right in my origianl pot
This also doesn't work:

const scenes = Actions.create(
    <Stack key="root">
      <Scene key='Loading'
          component={Loading}
          title="Loading"/>
      <Scene key='HomeScene'
              component={MainView}
              title="APP"/>
        <Scene key='Detailed'
            component={DetailedItemScene}
            title="APP"/>
      </Stack>
)

Please insert your scenes as Router children, Actions.create way is not supported yet by v4.

I had tried to do that, and it didn't change anything.

I managed to get v3 working again so I'm not bothering with this bug anymore, but there is definitely something wrong here and this is preventing me from getting v4 working. There are a quite a few similar issues like this that have been closed with no real resolution.

It is hard to say anything without the code. Check Example project - Actions calls are working fine there. Try to modify and reproduce.

any update on this?

same issue.. any updates on this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

basdvries picture basdvries  路  3Comments

jgibbons picture jgibbons  路  3Comments

sreejithr picture sreejithr  路  3Comments

booboothefool picture booboothefool  路  3Comments

GCour picture GCour  路  3Comments