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

QUESTION: How to disable swipe-back but not disable drawer-swipe #2226

Closed
abeltje1 opened this issue Aug 13, 2017 · 6 comments
Closed

QUESTION: How to disable swipe-back but not disable drawer-swipe #2226

abeltje1 opened this issue Aug 13, 2017 · 6 comments

Comments

@abeltje1
Copy link

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.17
  • react-native v0.46.4

Now, when implementing a drawer, swiping left opens the drawer AND pops the scene. The only workaround is to disable gestures altogether by using panHandlers or disableGestures but that's not the behaviour i'd like. My question: is it possible at this moment to only disable swipe-back gestures but not drawer-init-gestures per scene?

@zainmustafa
Copy link

Try adding type="replace in drawer Scene.
This works for me.

<Scene key="drawer" drawer contentComponent={SideBar} type="replace" hideNavBar={true}>
      <Scene key="main" >
          <Scene key="scarlet" component={ScarletScreen} title="Scarlet" />
    </Scene>
</Scene>

@aksonov
Copy link
Owner

aksonov commented Aug 14, 2017

@abeltje1 I don't understand your issue. Check Example project, tab2_2 - it has panHandlers disabled but you still can open drawer by swipe.

@abeltje1
Copy link
Author

@aksonov you're right, on my simulator I couldnt swipe for some reason but on phone it actually works, sorry. Is the reverse also possible? (Disable drawer swipe but not back swipe)?

Thanks for your response!

@aksonov
Copy link
Owner

aksonov commented Aug 16, 2017

It is not supported yet: react-navigation/react-navigation#390

@aksonov aksonov closed this as completed Aug 16, 2017
@preetampatil3d
Copy link

@aksonov ,

Below is my Router,


<ReduxRouter getSceneStyle={getSceneStyle}>
<Scene overlay>
<Scene navigationBarStyle={[{backgroundColor: '#005685'}]} leftButtonTextStyle={{ color: 'green' }} backButtonTextStyle={{ color: 'red' }} initial>
<Scene key="modal" modal hideNavBar>
<Scene key="drawer" drawer contentComponent={SideDrawer} >
<Scene key='root' >
<Scene key="HomeComponent" component={HomeComponent} initial renderTitle={() => { return <AppLogo name="App Name" />; }} />
<Scene back={true} key="SecondPage" component={SecondComponent} renderTitle={() => { return <AppLogo name="App Name" />; }} />
<Scene back={true} key="ThirdPage" component={ThirdComponent} renderTitle={() => { return <AppLogo name="App Name" />; }} />			
</Scene>
</Scene>			
</Scene>
</Scene>
</Scene>
</ReduxRouter>

Current behavior: Drawer is visible on 'HomeComponent' and i have disabled it on other scenes using "back={true}".
But on SecondComponent & ThirdComponent swipe back opens drawer and also goes to back page on closing of drawer.

Expected:

  1. Drawer on all page and back button on all page except HomeComponent.
    OR
  2. Drawer on HomeComponent and back button on rest of the pages .
    (Drawer or back button back button must be disabled on thease page, to avoid comflict)

Any solution or any alternate ways to overcome this issue ?
Anybody please help.

Thanks in advance.

@alex-shevchenko
Copy link

@preetampatil3d did you found any solution for your case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants