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

Disable swipe back function #3050

Closed
rodrigofbm opened this issue May 23, 2018 · 11 comments
Closed

Disable swipe back function #3050

rodrigofbm opened this issue May 23, 2018 · 11 comments

Comments

@rodrigofbm
Copy link

rodrigofbm commented May 23, 2018

Version

  • react-native-router-flux v4.0.0 @beta.21
  • react-native v0.54.3

Expected behaviour

Disable swipe back function

Actual behaviour

I can't make it work

Steps to reproduce

I have tryied:

  1. type="reset", but it minimizes the app
  2. panHandlers={null}
  3. gesturesEnabled={false}

but nothing works for me. Can someone help me?

Code:

<Router>
            <Stack key="root">
              <Scene key="Inicio" component={Inicio} titleStyle={{color: '#FFF', fontSize: 18}} navigationBarStyle={{ backgroundColor: '#4c486f' }} title="All About My Pet" type="reset"/>
              <Scene key="FormLogin" component={FormLogin} titleStyle={{color: '#FFF', fontSize: 18}} navigationBarStyle={{ backgroundColor: '#4c486f' }} title="Faça seu Login"/>
              <Scene key="FormCadastro" component={FormCadastro} titleStyle={{color: '#FFF', fontSize: 18}} title navigationBarStyle={{ backgroundColor: '#066c76' }} title="Cadastro"/>
            </Stack>
</Router>
@vonqo
Copy link

vonqo commented May 24, 2018

You can use

import { Scene, Router, ActionConst } from 'react-native-router-flux'; 

then

<Scene key="someScene" type={ActionConst.REPLACE} />

Scene will be disabled doing swipe back.

@rodrigofbm
Copy link
Author

@lupino22
After I added type={ActionConst.REPLACE} the scene does not load anymore. Just type='reset' works, but it minizes the app

@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
@faheem121
Copy link

just put the gestureEnabled={false} in scene tag
example:its work for me after login switch to home scene and now never swipe back

@faheem121
Copy link

image

@adeamos83
Copy link

adeamos83 commented Sep 26, 2018

You must use "drawerLockMode='locked-closed' gesturesEnabled={false}" together inorder for the swipe action to be fully disabled

<Scene key="home" drawerLockMode='locked-closed' gesturesEnabled={false} component={HomeContainer}/>

@jituumaria
Copy link

Version

  • react-native-router-flux v4.0.0 @beta.21
  • react-native v0.54.3

Expected behaviour

Disable swipe back function

Actual behaviour

I can't make it work

Steps to reproduce

I have tryied:

  1. type="reset", but it minimizes the app
  2. panHandlers={null}
  3. gesturesEnabled={false}

but nothing works for me. Can someone help me?

Code:

<Router>
            <Stack key="root">
              <Scene key="Inicio" component={Inicio} titleStyle={{color: '#FFF', fontSize: 18}} navigationBarStyle={{ backgroundColor: '#4c486f' }} title="All About My Pet" type="reset"/>
              <Scene key="FormLogin" component={FormLogin} titleStyle={{color: '#FFF', fontSize: 18}} navigationBarStyle={{ backgroundColor: '#4c486f' }} title="Faça seu Login"/>
              <Scene key="FormCadastro" component={FormCadastro} titleStyle={{color: '#FFF', fontSize: 18}} title navigationBarStyle={{ backgroundColor: '#066c76' }} title="Cadastro"/>
            </Stack>
</Router>

using

type="replace"

@AE0011
Copy link

AE0011 commented Jan 5, 2019

@adeamos83 Thanks it works

@Ryan113
Copy link

Ryan113 commented May 19, 2019

<Router navigationBarStyle={styles.navBar} titleStyle={styles.navTitle} panHandlers={null} >

Worked for me.

@moribaleta
Copy link

Can you disable Swipe Back gesture on the Class itself?

@AliUZAR
Copy link

AliUZAR commented Apr 8, 2020

You must use "drawerLockMode='locked-closed' gesturesEnabled={false}" together inorder for the swipe action to be fully disabled

<Scene key="home" drawerLockMode='locked-closed' gesturesEnabled={false} component={HomeContainer}/>

Thanks

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

10 participants