[Navigator] renderScene onBack not working?
See original GitHub issueHey, so mistake me if I’m wrong but I’m trying to use the onBack function from the example and it doesn’t do anything. I am trying to have a callback that when I swipe back from my video view to my videos view something happens (like navigator.popToTop()).
Can anyone help me understand how I can create a callback properly when the user swipes back to the scene?
Thanks!
renderScene: function(route, navigator){
switch (route.id){
case 'login':
if(Parse.User.current()){
return <Feed/>
}else{
return <Login/>
}
case 'signup':
return <Signup/>;
case 'feed':
return <Feed/>;
case 'video':
return <Video name={route.name} url={route.url} onBack={() => {
console.log('you swiped back!');
}} />;
default:
return <Login/>;
}
},
render: function(){
return (
<Navigator style={{backgroundColor: 'black'}} ref="navigator"
initialRoute={{id: 'login'}}
renderScene={this.renderScene}
/>
)
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
React Navigation back() and goBack() not working
The key property for goBack() is a dynamically created string, created by react-navigation whenever it navigates to a new route.
Read more >Call a function when focused screen changes
In this guide we will call a function or render something on screen focusing. ... This could cause issues depending on the type...
Read more >Navigate to a new screen and back
Navigate to a new screen and back · 1. Create two routes. First, create two routes to work with. · 2. Navigate to...
Read more >Custom Handling the Android Back Button with ... - Code Daily
Not only that you may want to control the back navigation based upon the state of ... onBack); } render() { return this.props.children;...
Read more >React Navigation re-render / reset previous page's state on ...
Various stackoverflow and medium articles, but not the thing I was looking for. Problem statement: In a react native mobile app, when a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey! We’re working on making this easier. In the next release (and in master), there is a new way to monitor navigation changes:
In the current release, you can get similar events by adding handlers to the navigator component: (keep in mind this will be deprecated)
👍