-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 gesture back action #2006
Comments
you can put panHandlers={null} in a parent/root Scene to disable this behavior. |
I just tested panHandlers={null} and it does not work, @aksonov can you reopen this. |
Fork & reproduce it with Example project. |
I've also tried panHandlers={null} but it's not working. On another note: is it possible to only disable certain scenes within a parent scene? (i.e. I have 3 child-scenes and want only two of them to have the swipe-back)? |
Nevermind, It was a mistake on my end: everything works great, sorry! |
@abeltje1 how did you solved it? Can you please help me out? Here is my code.
I dont user to go from Screen1 back to SplashScreen. How can i do that? |
You mean with swipe right? or just in general no back-button? try setting panHandlers={null} on screen1 |
@abeltje1 In general no back button at all. Back button should be only at Screen 2. So actual navigation will be between screen 1 and screen2. Splashscreen will be in its own zone. panHandlers={null} doesn't solves the issue.
I used to achieve this in previous version of RNRF using Scene buckets. But in this version i cannot write nested scenes. |
panHandler={null} is for touchevents. If you want to disable the back button you should use the back property on the scene, or if you want to hide the navbar altogether you should use hideNavBar |
@abeltje1 if i use hideNavBar i can still go back to the splash screen which i don't want. back property is of no help. Can you give me any more pointers? |
I'll try, though I'm confused a lot of times with RNRF myself - just started developing with RN and Redux and it's a little much, so excuse me if I'm wrong. Let me ask a few questions to understand better what's going on, okay? 1: When in screen 1, can you still swipe from the left side of the screen to go to the splash screen? I tried it myself and with hideNavBar there is no back button left. Secondly I also tried panHandlers={null} and that disables the swipe. To me it looks like this piece of code below should disable going back altogether. can you confirm this does not work and if that's the case: can you tell me which back option still works (back button in header OR swipe OR both)?
cheers |
@abeltje1 Are you using the beta version?
|
Works like a charm indeed (even though panHandlers worked for me too). do you perhaps know how to disable the drawer but not the swipe left? @themakerman |
Sorry, it seems not supported yet by react-navigation (disable gestures for drawer) react-navigation/react-navigation#390 |
type={ActionConst.RESET} in Scene |
@haythamAKL solution works, but dont forget to import ActionConst from the react-native-router-flux |
you can use |
Nothing work. Can someone help? |
what do you mean mate? @rodrigofbm both v3 and v4 works now. mind sharing your implementation? I am using type={ActionConst.RESET} in Scenes and it's been working since. |
@yeomann Yeah! Work's, thanks por sharing! |
I'm also facing the same problem |
@chirag773 What problem are you facing? You can provide the prop type={ActionConst.RESET} to the scene from which you don't want to go back. You can also use Actions.reset('Screen1') in the SplashScreen component (from the example above). |
@aksonov I am also facing the same issue
I have given type={ActionConst.RESET} in Home Scene, Still after login when i press back , It take User Back to Login screen. I have two screens - Login and Home. after successful login , do not take user back to Login screen . Can some one help me ? |
Use-- Actions.your screen kry();
…On Wed, Mar 6, 2019, 8:16 PM FaizalMalik ***@***.***> wrote:
@aksonov <https://github.com/aksonov> I am also facing the same issue
<RouterWithRedux>
<Scene key='root'>
<Scene
component={Login}
initial={!token}
hideNavBar={true}
key='Login'
title='Login'
/>
<Drawer
hideNavBar
key="drawer"
contentComponent={LeftSideMenu}
drawerImage={MenuIcon}
drawerWidth={300}
>
<Scene
component={Home}
hideNavBar={false}
key='Home'
title='Home'
type={ActionConst.RESET}
/>
</Drawer>
</Scene>
</RouterWithRedux>
I have given type={ActionConst.RESET} in Home Scene, Still after login
when i press back , It take User Back to Login screen.
I have two screens - Login and Home. after successful login , do not take
user back to Login screen .
Can some one help me ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2006 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZy1DqPl2TWFHuf6om7ZVhQxXTY5N7Q4ks5vT9TcgaJpZM4OTmbX>
.
|
This is what worked for me: |
In V4 it would be good there was an option to disable the gesture back button for a specific scene. For example, I have my user login scene and then my home scene once a user login he is taken to the home scene but then he can gesture back to the login.
The text was updated successfully, but these errors were encountered: