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

Current scene pushes over the same scene when drawer is closed on IOs #2342

Closed
donnes opened this issue Sep 5, 2017 · 5 comments
Closed

Comments

@donnes
Copy link

donnes commented Sep 5, 2017

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.19 (v3 is not supported)
  • react-native v0.47.1

Expected behaviour

Close drawer and stay the current scene "statically opened".

Actual behaviour

When drawer is closed the current scene is pushed over the same scene.

Steps to reproduce

https://youtu.be/p2nMPAHm77o

Example code:

const scenes = Actions.create(
  <Scene key="lightbox" lightbox>
    <Scene key="modal" modal>
      <Stack
        key="root"
        navigationBarStyle={styles.navBar}
        titleWrapperStyle={styles.navBarTitleWrapper}
        titleStyle={styles.navBarTitle}
        hideBackImage={true}
        renderBackButton={() => <BackButton />}
        hideNavBar
        hideTabBar
      >
        <Scene key="splash" modal component={Splash} initial />

        <Scene key="auth">
          <Scene key="login" component={requireNotAuth(Login)} hideNavBar />
          <Scene
            key="loginSelection"
            component={requireNotAuth(Selection)}
            hideNavBar
          />
        </Scene>

        <Scene
          key="drawer"
          drawer
          contentComponent={Sidebar}
          renderLeftButton={() => (
            <FontAwesome name="bars" size={24} style={styles.navBarIcon} />
          )}
          hideNavBar
        >
          <Scene key="list" component={requireAuth(List)} />
          <Scene
            key="components"
            component={requireAuth(ComponentsList)}
            title="Components List"
          />
        </Scene>

        <Scene key="filter" back>
          <Scene
            key="filterModal"
            component={Filter}
            title={I18n.t('titles.filterModal')}
          />
        </Scene>
      </Stack>
    </Scene>
  </Scene>
);
@mcabs3
Copy link
Collaborator

mcabs3 commented Sep 5, 2017

@donnes I ran into this bug too in the example project, try wrapping your scenes that are children of the Drawer in a Scene, so that the Drawer has one direct child Scene and then that child has your components and list Scenes

@aksonov
Copy link
Owner

aksonov commented Sep 10, 2017

Also you have to always latest version before reporting.

@aksonov aksonov closed this as completed Sep 10, 2017
@donnes
Copy link
Author

donnes commented Sep 11, 2017

@asokol I upgraded to the latest version and tried the solution that @mcabs3 mentioned and the problem still happening.

Do you have any idea why this occurs?

@mcabs3
Copy link
Collaborator

mcabs3 commented Sep 11, 2017

@asokol try looking at the Example project, I think I have what I fixed in there. Can you provide your current router/scenes as well as the methods you are running to navigate?

@donnes
Copy link
Author

donnes commented Sep 11, 2017

@mcabs3 I tried to wrap my scenes inside the drawer.

My current scenes code:

I'm navigating using simple Actions.ROUTE_KEY()

const scenes = Actions.create(
  <Scene key="lightbox" lightbox>
    <Scene key="modal" modal>
      <Stack
        key="root"
        navigationBarStyle={styles.navBar}
        titleWrapperStyle={styles.navBarTitleWrapper}
        titleStyle={styles.navBarTitle}
        hideBackImage={true}
        renderBackButton={() => <BackButton />}
        hideNavBar
        hideTabBar
      >
        <Scene key="splash" modal component={Splash} initial />

        <Scene key="auth">
          <Scene key="login" component={requireNotAuth(Login)} hideNavBar />
          <Scene
            key="loginSelection"
            component={requireNotAuth(Selection)}
            hideNavBar
          />
        </Scene>

        <Scene
          key="drawer"
          drawer
          contentComponent={Sidebar}
          renderLeftButton={() => <DrawerButton />}
          hideNavBar
        >
          <Scene key="main">
            <Scene key="list" component={requireAuth(List)} />
            <Scene key="detail" component={requireAuth(Detail)} back />
            <Scene
              key="components"
              component={requireAuth(ComponentsList)}
              title="Components List"
            />
          </Scene>
        </Scene>

        <Scene key="filter" back>
          <Scene
            key="filterModal"
            component={Filter}
            title={I18n.t('titles.filterModal')}
          />
        </Scene>
      </Stack>
    </Scene>
  </Scene>
);

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