Skip to content

"Cannot find scene with key = drawer" error with Switch #560

Closed
@sarovin

Description

@sarovin
  • react-native-router-flux v3.22.1
  • react-native v0.22.2

Expected behaviour

i have this selector:

const selectorCheck = (user) => {

  if ( user && ( user.auth_token || user.isGuest ) ) {
    return 'drawer'
  }
  return 'auth'
}

and this Scene:

const scenes = Actions.create(
  <Scene key="root"
    hideNavBar={true}
    component={ connect(({ user }) => ({ user }))(Switch) }
    selector={ ({ user }) => selectorCheck(user) }
    >
    <Scene key="auth"
      >
      <Scene key="signin" component={SignIn} title="Accedi all'App" type="replace" direction="vertical" />
      <Scene key="signup" component={SignUp} title="Crea il tuo account" direction="vertical" />
      <Scene key="otpScreen" component={OTPScreen} title="Verifica di sicurezza" direction="vertical" />
    </Scene>
    <Scene key="drawer" component={Drawer} >
      <Scene key="main" >
        <Scene key="search" component={Search} title="Search" type="replace" />
      </Scene>
    </Scene>
  </Scene>
);

Actual behaviour

But return:

Cannot find scene with key=drawer
Cannot read property 'key' of undefined

schermata 2016-04-20 alle 12 37 02

Is there something wrong with my code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions