Improve consistency of NavigationCardStack animations.
Summary:Currently there?s an inconsistency between the animations used in `NavigationAnimatedView` (`spring`) and those in `NavigationCardStack` (`timing`), which is noticeable when switching between the two implementations.
By removing the `_applyAnimation` method, the `NavigationAnimatedView` will simply use its [default `applyAnimation`](6c22a2174e/Libraries/NavigationExperimental/NavigationAnimatedView.js (L56-L67)
), making the animation styles the same.
**Before** (with `Animated.timing`)
Video: http://quick.as/Yexku8DdJ
**After** (with the default `NavigationAnimatedView` animations)
Video: http://quick.as/qrqbsnj8n
Closes https://github.com/facebook/react-native/pull/6636
Differential Revision: D3094638
Pulled By: ericvicenti
fb-gh-sync-id: 6e1c7c54b4ef102c4003719381d334d2c6f7a531
shipit-source-id: 6e1c7c54b4ef102c4003719381d334d2c6f7a531
This commit is contained in:
Родитель
b80698df1c
Коммит
07697d15cc
|
@ -50,7 +50,6 @@ const {Directions} = NavigationCardStackPanResponder;
|
|||
|
||||
import type {
|
||||
NavigationAnimatedValue,
|
||||
NavigationAnimationSetter,
|
||||
NavigationParentState,
|
||||
NavigationSceneRenderer,
|
||||
NavigationSceneRendererProps,
|
||||
|
@ -94,7 +93,6 @@ const defaultProps = {
|
|||
* +------------+
|
||||
*/
|
||||
class NavigationCardStack extends React.Component {
|
||||
_applyAnimation: NavigationAnimationSetter;
|
||||
_renderScene : NavigationSceneRenderer;
|
||||
|
||||
constructor(props: Props, context: any) {
|
||||
|
@ -102,7 +100,6 @@ class NavigationCardStack extends React.Component {
|
|||
}
|
||||
|
||||
componentWillMount(): void {
|
||||
this._applyAnimation = this._applyAnimation.bind(this);
|
||||
this._renderScene = this._renderScene.bind(this);
|
||||
}
|
||||
|
||||
|
@ -120,7 +117,6 @@ class NavigationCardStack extends React.Component {
|
|||
navigationState={this.props.navigationState}
|
||||
renderOverlay={this.props.renderOverlay}
|
||||
renderScene={this._renderScene}
|
||||
applyAnimation={this._applyAnimation}
|
||||
style={[styles.animatedView, this.props.style]}
|
||||
/>
|
||||
);
|
||||
|
@ -147,19 +143,6 @@ class NavigationCardStack extends React.Component {
|
|||
/>
|
||||
);
|
||||
}
|
||||
|
||||
_applyAnimation(
|
||||
position: NavigationAnimatedValue,
|
||||
navigationState: NavigationParentState,
|
||||
): void {
|
||||
Animated.timing(
|
||||
position,
|
||||
{
|
||||
duration: 500,
|
||||
toValue: navigationState.index,
|
||||
}
|
||||
).start();
|
||||
}
|
||||
}
|
||||
|
||||
NavigationCardStack.propTypes = propTypes;
|
||||
|
|
Загрузка…
Ссылка в новой задаче