From e71843109bf0c4a97d1a9d0dbb5100d2743cbf7a Mon Sep 17 00:00:00 2001 From: William Candillon Date: Tue, 9 Jul 2019 20:51:38 +0200 Subject: [PATCH] =?UTF-8?q?feat(=F0=9F=8D=83):=20Make=20spring()=20configu?= =?UTF-8?q?rable=20(#77)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Gesture.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Gesture.ts b/src/Gesture.ts index 5f15413e..f63f8751 100644 --- a/src/Gesture.ts +++ b/src/Gesture.ts @@ -83,14 +83,15 @@ export const spring = ( translation: Animated.Value, state: Animated.Value, snapPoint: Animated.Adaptable, - defaultOffset: number = 0 + defaultOffset: number = 0, + springConfig?: Animated.SpringConfig ) => { const springedValue = new Value(0); const offset = new Value(defaultOffset); const clock = new Clock(); const rerunSpring = new Value(0); // http://chenglou.github.io/react-motion/demos/demo5-spring-parameters-chooser/ - const springConfig = { + const config = springConfig || { toValue: new Value(0), damping: 15, mass: 1, @@ -105,7 +106,7 @@ export const spring = ( [ set( springedValue, - runSpring(clock, add(translation, offset), snapPoint, springConfig) + runSpring(clock, add(translation, offset), snapPoint, config) ) ], [