Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawer's default scene Reloads Twice #3096

Closed
ankur-nd opened this issue Jun 26, 2018 · 2 comments
Closed

Drawer's default scene Reloads Twice #3096

ankur-nd opened this issue Jun 26, 2018 · 2 comments

Comments

@ankur-nd
Copy link

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.31
  • react-native v0.55.4

Expected behaviour

On signing-in the default scene of navigation drawer should load just once i.e. componentDidMount() and componentWillMount() should be called just once.

Actual behaviour

On signing-in the default scene of navigation drawer's componentDidMount() and componentWillMount() gets called twice.

Steps to reproduce

I have a scene 'alertsView' which is supposed to be the default scene i.e. if back is pressed from any scene, user should land at scene 'alertsView'.
In order to work around this bug:
#2342

I went for wrapping scenes that are children of the Drawer in a Scene 'drawerRoot', so that the Drawer has one direct child Scene and then that child has components and list Scenes.

Snippet from my router file:

<Drawer
            key="main"
            contentComponent={DrawerMenu}
            hideNavBar
            initial={loginState === LOGGED_IN}
            drawerOpenRoute="DrawerOpen"
            drawerCloseRoute="DrawerClose"
            drawerToggleRoute="DrawerToggle">

           
            <Scene
              key="drawerRoot"
              hideNavBar>
              <Scene
                key="alertsView"
                component={AlertsView}
                hideNavBar={false}
                initial={loginState === LOGGED_IN}
              />


              <Scene
                key="GZchart"
........
.......

@ankur-nd ankur-nd changed the title Component Reloads Twice Drawer's default scene Reloads Twice Jun 27, 2018
@china-english
Copy link

Same issue here.

  • "react": "16.3.1"
  • "react-native": "0.55.4"
  • "react-native-router-flux": "^4.0.0-beta.31"

@aksonov
Copy link
Owner

aksonov commented Aug 8, 2018

Please try to reproduce it with Example project and latest version 4.0.0-beta.40. Feel free to open if the issue still exists

@aksonov aksonov closed this as completed Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants