diff --git a/src/AnimatedNumber.js b/src/AnimatedNumber.js index 5c4d37b..6b681ef 100644 --- a/src/AnimatedNumber.js +++ b/src/AnimatedNumber.js @@ -39,11 +39,11 @@ class AnimatedNumber extends React.PureComponent { }); } } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { const { value } = this.props; - if (value !== nextProps.value) { - this.move(nextProps); + if (prevProps.value !== value) { + this.move(this.props); } } onValueChanged = e => { diff --git a/src/AnimatedText.js b/src/AnimatedText.js index 41fcd3e..5f256ac 100644 --- a/src/AnimatedText.js +++ b/src/AnimatedText.js @@ -28,11 +28,11 @@ class AnimatedText extends React.PureComponent { originLength: value.length, }; } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { const { value } = this.props; - if (value !== nextProps.value) { - this.change(nextProps); + if (prevProps.value !== value) { + this.change(this.props); } } onValueChanged = e => { diff --git a/src/Opacity.js b/src/Opacity.js index 90b369c..c1c55bf 100644 --- a/src/Opacity.js +++ b/src/Opacity.js @@ -19,11 +19,11 @@ class Opacity extends PureComponent { opacityValue: new Animated.Value(value), }; } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { const { value } = this.props; - if (value !== nextProps.value) { - this.move(nextProps); + if (prevProps.value !== value) { + this.move(this.props); } } move = props => { diff --git a/src/Scale.js b/src/Scale.js index 720fbf8..167f576 100644 --- a/src/Scale.js +++ b/src/Scale.js @@ -34,21 +34,21 @@ class Scale extends PureComponent { }); } } - componentWillReceiveProps(nextProps) { - const { value } = this.props; + componentDidUpdate(prevProps) { + const { value, runAfterInteractions } = this.props; - if (value !== nextProps.value) { + if (prevProps.value !== value) { if (this.interaction) { this.interaction.cancel(); } - if (nextProps.runAfterInteractions) { + if (runAfterInteractions) { this.interaction = InteractionManager.runAfterInteractions(() => { this.interaction = null; - this.move(nextProps); + this.move(this.props); }); } else { - this.move(nextProps); + this.move(this.props); } } } diff --git a/src/ScaleAndOpacity.js b/src/ScaleAndOpacity.js index 50ec816..31c6dbc 100644 --- a/src/ScaleAndOpacity.js +++ b/src/ScaleAndOpacity.js @@ -43,14 +43,14 @@ class ScaleAndOpacity extends PureComponent { }); } } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { const { isHidden } = this.props; - if (!isHidden && nextProps.isHidden) { - this.hide(nextProps); + if (!prevProps.isHidden && isHidden) { + this.hide(this.props); } - if (isHidden && !nextProps.isHidden) { - this.show(nextProps); + if (prevProps.isHidden && !isHidden) { + this.show(this.props); } } hide = props => { diff --git a/src/Shake.js b/src/Shake.js index 94aca8c..3bbdd33 100644 --- a/src/Shake.js +++ b/src/Shake.js @@ -19,14 +19,13 @@ class Shake extends PureComponent { animatedValue: new Animated.Value(this.currentValue), }; } - // componentDidMount - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { const { value } = this.props; // Perform the shake if our `value` prop has been changed and is // being changed to a truthy value. - if (value !== nextProps.value && !!nextProps.value) { - this.move(nextProps); + if (prevProps.value !== value && !!value) { + this.move(this.props); } } move = props => { diff --git a/src/SharedElement.js b/src/SharedElement.js index 693e2d5..f745c0c 100644 --- a/src/SharedElement.js +++ b/src/SharedElement.js @@ -168,8 +168,8 @@ class SharedElement extends PureComponent { componentDidMount() { setProps(this.props); } - componentWillReceiveProps(nextProps) { - setProps(nextProps); + componentDidUpdate() { + setProps(this.props); } componentWillUnmount() { const { startOnDestinationWillUnmount } = this.props; diff --git a/src/TranslateX.js b/src/TranslateX.js index 4711d8d..5c6d678 100644 --- a/src/TranslateX.js +++ b/src/TranslateX.js @@ -35,11 +35,11 @@ class TranslateX extends PureComponent { }); } } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { const { value } = this.props; - if (value !== nextProps.value) { - this.move(nextProps.value); + if (prevProps.value !== value) { + this.move(this.props); } } move = toValue => { diff --git a/src/TranslateXY.js b/src/TranslateXY.js index 971895b..c466888 100644 --- a/src/TranslateXY.js +++ b/src/TranslateXY.js @@ -25,11 +25,11 @@ class TranslateXY extends PureComponent { translateValue: new Animated.ValueXY({ x, y }), }; } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { const { x, y } = this.props; - if (x !== nextProps.x || y !== nextProps.y) { - this.move(nextProps); + if (prevProps.x !== x || prevProps.y !== y) { + this.move(this.props); } } move = props => { diff --git a/src/TranslateY.js b/src/TranslateY.js index 004abcd..d73f98e 100644 --- a/src/TranslateY.js +++ b/src/TranslateY.js @@ -37,11 +37,11 @@ class TranslateY extends PureComponent { }); } } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { const { value } = this.props; - if (value !== nextProps.value) { - this.move(nextProps.value); + if (prevProps.value !== value) { + this.move(this.props); } } move = toValue => { diff --git a/src/TranslateYAndOpacity.js b/src/TranslateYAndOpacity.js index 3775b98..fdcdb18 100644 --- a/src/TranslateYAndOpacity.js +++ b/src/TranslateYAndOpacity.js @@ -39,14 +39,14 @@ class TranslateYAndOpacity extends PureComponent { }); } } - componentWillReceiveProps(nextProps) { + componentDidUpdate(prevProps) { const { isHidden } = this.props; - if (!isHidden && nextProps.isHidden) { - this.hide(nextProps); + if (!prevProps.isHidden && isHidden) { + this.hide(this.props); } - if (isHidden && !nextProps.isHidden) { - this.show(nextProps); + if (prevProps.isHidden && !isHidden) { + this.show(this.props); } } show(props) {