-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
How to switch from one view to the other? #919
Comments
You could use the Navigator for setting up scenes of your app and transitioning between them. Navigator has a The available animation properties on
So for instance if you wanted to provide some default animation for transition between scenes, you could do this: <Navigator
renderScene={this.renderScene}
style={styles.container}
configureScene={(route) => {
if (route.sceneConfig) {
return route.sceneConfig;
}
return Navigator.SceneConfigs.FloatFromRight;
}}
initialRoute={{
component: MyApp,
title: 'My App',
}}
/> and then later in your app when you want to override that animation you can provide a this.props.navigator.push({
title: 'Next Route',
component: NextRouteComponent,
sceneConfig: Navigator.SceneConfigs.FloatFromBottom
}) |
Thank you very much @mjw56 |
@mjw56 I met another problem, the Cause I want to prevent user to goback to previous Scene. So I have to use |
@ele828 hm, I am not sure about replace as I have not used that yet. @ericvicenti do you know if animations work with replace? Also, will the example above work with 0.4.0? |
I can confirm animation doesn't work with replace in 0.4.0. Probably we should close this and open a new issue for this. |
We currently don't support animations on replace. The closest thing we have so far is the ability to put a Navigator inside of a Navigator and do a push on the inside one. Or you could simply do a push and then call We usually want to avoid the animations for replace, because it lets us re-configure the route and the scene without causing any movement. If replace animates then we would loose that ability. I'm happy to hear more thoughts on how this can be improved! |
@mjw56 @ericvicenti - if there is still interest in pursuing animations on replace, let's open a new issue for it |
- references: - facebook/react-native#919 #How to switch from one view to the other?
Hi, I am wonder how to switch from one view to the other with some animation? Thanks
The text was updated successfully, but these errors were encountered: