From 84241fbcdc82a97f66bab67f41692e67592732f4 Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Wed, 25 Oct 2017 06:12:26 -0700 Subject: [PATCH] Make Animated.SpringAnimation JS compatible with Expo SDK 22 (CRNA) native code (#16513) --- Libraries/Animated/src/__tests__/AnimatedNative-test.js | 6 ++++++ Libraries/Animated/src/animations/SpringAnimation.js | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Libraries/Animated/src/__tests__/AnimatedNative-test.js b/Libraries/Animated/src/__tests__/AnimatedNative-test.js index 28a32c89ec4..6d08fb90b39 100644 --- a/Libraries/Animated/src/__tests__/AnimatedNative-test.js +++ b/Libraries/Animated/src/__tests__/AnimatedNative-test.js @@ -595,11 +595,14 @@ describe('Native Animated', () => { { type: 'spring', friction: 16, + damping: 16, + mass: 1, initialVelocity: 0, overshootClamping: false, restDisplacementThreshold: 0.001, restSpeedThreshold: 0.001, tension: 679.08, + stiffness: 679.08, toValue: 10, iterations: 1, }, @@ -613,11 +616,14 @@ describe('Native Animated', () => { { type: 'spring', friction: 23.05223140901191, + damping: 23.05223140901191, + mass: 1, initialVelocity: 0, overshootClamping: false, restDisplacementThreshold: 0.001, restSpeedThreshold: 0.001, tension: 299.61882352941177, + stiffness: 299.61882352941177, toValue: 10, iterations: 1, }, diff --git a/Libraries/Animated/src/animations/SpringAnimation.js b/Libraries/Animated/src/animations/SpringAnimation.js index 13f8c745b6e..e64e8e4ca59 100644 --- a/Libraries/Animated/src/animations/SpringAnimation.js +++ b/Libraries/Animated/src/animations/SpringAnimation.js @@ -120,6 +120,9 @@ class SpringAnimation extends Animation { restSpeedThreshold: this._restSpeedThreshold, tension: this._tension, friction: this._friction, + stiffness: this._tension, + damping: this._friction, + mass: 1, initialVelocity: withDefault(this._initialVelocity, this._lastVelocity), toValue: this._toValue, iterations: this.__iterations,