Disable swipe back function
I can't make it work
I have tryied:
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>
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.
@lupino22
After I added type={ActionConst.REPLACE} the scene does not load anymore. Just type='reset' works, but it minizes the app
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
just put the gestureEnabled={false} in scene tag
example:its work for me after login switch to home scene and now never swipe back

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}/>
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:
- type="reset", but it minimizes the app
- panHandlers={null}
- 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"
@adeamos83 Thanks it works
<Router navigationBarStyle={styles.navBar} titleStyle={styles.navTitle} panHandlers={null} >
Worked for me.
Can you disable Swipe Back gesture on the Class itself?
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
Most helpful comment
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}/>