react-native-router-flux: Problem with redux state and Switch after upgrading RN to v0.24

  • react-native-router-flux v3.24.0
  • react-native v0.24.1

After upgrading to RN v0.24 and the the latest RNRF something doesn’t work very well using Switch and Redux. Everything was working fine with RN v0.22. I’m using the built-in reducer for the router.

I have something like that

const selectorCheck = (auth) => {
  if (auth && !auth.token) {
    return 'isGuest'
  return 'isAuthenticated'

to switch from one group of scenes to the other if an auth.token is available.

Expected behaviour

Using the Redux debugger or a button to reset the state it should “switch” to the guest group of scenes (like it was doing with RN v0.22)

Actual behaviour

Doesn’t switch to the guest scene, the only way to do that is reloading the app using cmd+R

Steps to reproduce

  1. change the state in order to load the “isAuthenticated” group of scenes
  2. reset the state using the redux debugger or a button (tried both)

This is how my scenes look like:

const scenes = Actions.create(
  <Scene key="modal" component={ Modal } >
      component={ connect(({ auth }) => ({ auth }))(Switch) }
      selector={ ({ auth }) => selectorCheck(auth) }
      <Scene key="isGuest" style={ bgColor('red', 'base') }>
        <Scene key="launch" component={ Launch } title="Launch" initial />
      <Scene key="isAuthenticated">
        <Scene key="onboarding" component={ OnBoarding } title="OnBoarding" initial />

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@aksonov Just updated to RN 0.26 and latest version of RNRF (3.26.1). The problem is still present.

Switching back to RN 0.22 and RNRF 3.22 everything works fine