Skip to content

Commit

Permalink
fix(πŸ›): Make decay configuration and use platform defaults (#65)
Browse files Browse the repository at this point in the history
I took the platform default from https://facebook.github.io/react-native/docs/scrollview#decelerationrate πŸ€·πŸΌβ€β™‚οΈ
  • Loading branch information
wcandillon authored Jun 23, 2019
1 parent 1077c1c commit 36ca144
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/AnimationRunners.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Animated from "react-native-reanimated";
import {Platform} from "react-native";

const {
Value,
Expand All @@ -18,7 +19,8 @@ export function runDecay(
clock: Animated.Clock,
value: Animated.Adaptable<number>,
velocity: Animated.Adaptable<number>,
rerunDecaying: Animated.Value<number>
rerunDecaying: Animated.Value<number>,
deceleration?: number
) {
const state = {
finished: new Value(0),
Expand All @@ -28,7 +30,7 @@ export function runDecay(
};

const config = {
deceleration: 0.99
deceleration: deceleration || (Platform.OS === "ios" ? 0.998 : 0.985)
};

return [
Expand Down

0 comments on commit 36ca144

Please sign in to comment.