Rename setTiming to applyAnimation

Summary:Given that you can do all kinds of animations other than `Animated.timing`, it made no sense to have `setTiming`. In addition, you can't intuitively tell that this is the callback where you would do custom animations.

The discussion took place on Discord with ericvicenti: https://discordapp.com/channels/102860784329052160/154015578669973504
Closes https://github.com/facebook/react-native/pull/6235

Differential Revision: D2999121

Pulled By: hedgerwang

fb-gh-sync-id: f587b865de11ba5e8dc9c430720252ffb5d12794
shipit-source-id: f587b865de11ba5e8dc9c430720252ffb5d12794
This commit is contained in:
Richard Lai
2016-03-08 23:31:27 -08:00
committed by Facebook Github Bot 0
parent 6470ff842b
commit f2483eb1ee
3 changed files with 12 additions and 12 deletions

View File

@@ -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