From 4b25c4b86e45662d26158d97f2c9bf6cbf85f365 Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Tue, 11 Jan 2022 10:00:59 -0500 Subject: [PATCH 1/2] Use raw value for CalculatedAnimationDriver The fixes to change from animating the offset property to the value property missed a minor bug in CalculatedAnimationDriver, where we start the animation from the `Value` of the animated value node rather than the `RawValue`. This generally won't cause any bugs for animations that do not use the `Offset` property (via `setOffset`), as in those cases `Value` == `RawValue`. --- .../Modules/Animated/CalculatedAnimationDriver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vnext/Microsoft.ReactNative/Modules/Animated/CalculatedAnimationDriver.cpp b/vnext/Microsoft.ReactNative/Modules/Animated/CalculatedAnimationDriver.cpp index a675d96d567..e673ed6f5e1 100644 --- a/vnext/Microsoft.ReactNative/Modules/Animated/CalculatedAnimationDriver.cpp +++ b/vnext/Microsoft.ReactNative/Modules/Animated/CalculatedAnimationDriver.cpp @@ -18,7 +18,7 @@ std::tuple CalculatedA compositor.CreateLinearEasingFunction()); }(); - m_startValue = GetAnimatedValue()->Value(); + m_startValue = GetAnimatedValue()->RawValue(); std::vector keyFrames = [this]() { std::vector keyFrames; bool done = false; @@ -37,7 +37,7 @@ std::tuple CalculatedA std::chrono::milliseconds duration(static_cast(keyFrames.size() / 60.0f * 1000.0f)); animation.Duration(duration); auto normalizedProgress = 0.0f; - auto fromValue = static_cast(GetAnimatedValue()->RawValue()); + auto fromValue = static_cast(m_startValue); animation.InsertKeyFrame(normalizedProgress, fromValue, easingFunction); for (const auto keyFrame : keyFrames) { normalizedProgress = std::min(normalizedProgress + 1.0f / keyFrames.size(), 1.0f); From 3a90635a9350062af5d9381ecc0a951b9f59d4a2 Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Tue, 11 Jan 2022 10:26:10 -0500 Subject: [PATCH 2/2] Change files --- ...ative-windows-b50197bd-a2bb-423e-a088-a65afa8f7969.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/react-native-windows-b50197bd-a2bb-423e-a088-a65afa8f7969.json diff --git a/change/react-native-windows-b50197bd-a2bb-423e-a088-a65afa8f7969.json b/change/react-native-windows-b50197bd-a2bb-423e-a088-a65afa8f7969.json new file mode 100644 index 00000000000..93d57c2b523 --- /dev/null +++ b/change/react-native-windows-b50197bd-a2bb-423e-a088-a65afa8f7969.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Use raw value for CalculatedAnimationDriver", + "packageName": "react-native-windows", + "email": "erozell@outlook.com", + "dependentChangeType": "patch" +}