React-native-router-flux: Disable swipe back function

Created on 23 May 2018  路  11Comments  路  Source: aksonov/react-native-router-flux

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>

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}/>

All 11 comments

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

image

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:

  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"

@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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sarovin picture sarovin  路  3Comments

willmcclellan picture willmcclellan  路  3Comments

basdvries picture basdvries  路  3Comments

VictorK1902 picture VictorK1902  路  3Comments

xnog picture xnog  路  3Comments