From bca46f2c3f1eb3dffb2b3ff0834e04c5162a672c Mon Sep 17 00:00:00 2001 From: Guillaume <7831777+GuillaumeOj@users.noreply.github.com> Date: Tue, 20 May 2025 10:37:33 +0200 Subject: [PATCH] fix: replaces UNSAFE_componentWillReceiveProps with componentDidUpdate --- createAnimatableComponent.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/createAnimatableComponent.js b/createAnimatableComponent.js index 7be96ea..2df8f3c 100644 --- a/createAnimatableComponent.js +++ b/createAnimatableComponent.js @@ -317,8 +317,7 @@ export default function createAnimatableComponent(WrappedComponent) { } } - // eslint-disable-next-line camelcase - UNSAFE_componentWillReceiveProps(props) { + componentDidUpdate(previousProps) { const { animation, delay, @@ -327,12 +326,12 @@ export default function createAnimatableComponent(WrappedComponent) { iterationDelay, transition, onAnimationBegin, - } = props; + } = this.props; if (transition) { - const values = getStyleValues(transition, props.style); + const values = getStyleValues(transition, this.props.style); this.transitionTo(values, duration, easing, delay); - } else if (!deepEquals(animation, this.props.animation)) { + } else if (!deepEquals(animation, previousProps.animation)) { if (animation) { if (this.delayTimer) { this.setAnimation(animation); @@ -418,7 +417,7 @@ export default function createAnimatableComponent(WrappedComponent) { : iterationCount <= 1, duration: duration || this.props.duration || 1000, useNativeDriver, - delay: (iterationDelay && currentIteration > 0) ? iterationDelay : 0, + delay: iterationDelay && currentIteration > 0 ? iterationDelay : 0, }; Animated.timing(animationValue, config).start((endState) => {