diff --git a/Examples/UIExplorer/NavigationExperimental/NavigationAnimatedExample.js b/Examples/UIExplorer/NavigationExperimental/NavigationAnimatedExample.js index d034d87f5..c27f3170d 100644 --- a/Examples/UIExplorer/NavigationExperimental/NavigationAnimatedExample.js +++ b/Examples/UIExplorer/NavigationExperimental/NavigationAnimatedExample.js @@ -78,7 +78,7 @@ class NavigationAnimatedExample extends React.Component { navigationState={navigationState} style={styles.animatedView} renderOverlay={this._renderHeader} - setTiming={(pos, navState) => { + applyAnimation={(pos, navState) => { Animated.timing(pos, {toValue: navState.index, duration: 1000}).start(); }} renderScene={this._renderCard} diff --git a/Libraries/CustomComponents/NavigationExperimental/NavigationCardStack.js b/Libraries/CustomComponents/NavigationExperimental/NavigationCardStack.js index 3c88d2ac3..d857da293 100644 --- a/Libraries/CustomComponents/NavigationExperimental/NavigationCardStack.js +++ b/Libraries/CustomComponents/NavigationExperimental/NavigationCardStack.js @@ -77,16 +77,16 @@ const defaultProps = { * A controlled navigation view that renders a list of cards. */ class NavigationCardStack extends React.Component { + _applyAnimation: NavigationAnimationSetter; _renderScene : NavigationSceneRenderer; - _setTiming: NavigationAnimationSetter; constructor(props: Props, context: any) { super(props, context); } - componentWillMount() { + componentWillMount(): void { + this._applyAnimation = this._applyAnimation.bind(this); this._renderScene = this._renderScene.bind(this); - this._setTiming = this._setTiming.bind(this); } shouldComponentUpdate(nextProps: Object, nextState: Object): boolean { @@ -103,7 +103,7 @@ class NavigationCardStack extends React.Component { navigationState={this.props.navigationState} renderOverlay={this.props.renderOverlay} renderScene={this._renderScene} - setTiming={this._setTiming} + setTiming={this._applyAnimation} style={[styles.animatedView, this.props.style]} /> ); @@ -120,7 +120,7 @@ class NavigationCardStack extends React.Component { ); } - _setTiming( + _applyAnimation( position: NavigationAnimatedValue, navigationState: NavigationParentState, ): void { diff --git a/Libraries/NavigationExperimental/NavigationAnimatedView.js b/Libraries/NavigationExperimental/NavigationAnimatedView.js index c77569a77..8eb8e832c 100644 --- a/Libraries/NavigationExperimental/NavigationAnimatedView.js +++ b/Libraries/NavigationExperimental/NavigationAnimatedView.js @@ -63,12 +63,12 @@ function compareScenes( } type Props = { + applyAnimation: NavigationAnimationSetter, navigationState: NavigationParentState, onNavigate: (action: any) => void, - renderScene: NavigationSceneRenderer, renderOverlay: ?NavigationSceneRenderer, + renderScene: NavigationSceneRenderer, style: any, - setTiming: NavigationAnimationSetter, }; type State = { @@ -79,15 +79,15 @@ type State = { const {PropTypes} = React; const propTypes = { + applyAnimation: PropTypes.func, navigationState: NavigationPropTypes.navigationState.isRequired, onNavigate: PropTypes.func.isRequired, - renderScene: PropTypes.func.isRequired, renderOverlay: PropTypes.func, - setTiming: PropTypes.func, + renderScene: PropTypes.func.isRequired, }; const defaultProps = { - setTiming: ( + applyAnimation: ( position: NavigationAnimatedValue, navigationState: NavigationParentState, ) => { @@ -152,7 +152,7 @@ class NavigationAnimatedView componentDidUpdate(lastProps: Props): void { if (lastProps.navigationState.index !== this.props.navigationState.index) { - this.props.setTiming( + this.props.applyAnimation( this.state.position, this.props.navigationState, lastProps.navigationState