Skip to content

Commit 1b85a2b

Browse files
committed
fix bug in default animationConfig
1 parent 33c2078 commit 1b85a2b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

index.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ const {
4949
// Fire onScrollComplete when within this many
5050
// px of target offset
5151
const onScrollCompleteThreshold = 2
52+
const defaultAnimationConfig = {
53+
damping: 20,
54+
mass: 0.2,
55+
stiffness: 100,
56+
overshootClamping: false,
57+
restSpeedThreshold: 0.2,
58+
restDisplacementThreshold: 0.2,
59+
}
5260

5361
const debugGestureState = (state, context) => {
5462
const stateStr = Object.entries(GestureState).find(([k, v]) => v === state)
@@ -155,6 +163,7 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
155163
}
156164

157165
hoverAnimConfig = {
166+
...defaultAnimationConfig,
158167
...this.props.animationConfig,
159168
toValue: sub(this.hoverTo, sub(this.scrollOffset, this.hoverScrollSnapshot)),
160169
}
@@ -193,14 +202,7 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
193202
static defaultProps = {
194203
autoscrollThreshold: 30,
195204
autoScrollSpeed: 100,
196-
animationConfig: {
197-
damping: 20,
198-
mass: 0.2,
199-
stiffness: 100,
200-
overshootClamping: false,
201-
restSpeedThreshold: 0.2,
202-
restDisplacementThreshold: 0.2,
203-
},
205+
animationConfig: {},
204206
}
205207

206208
constructor(props: Props<T>) {

0 commit comments

Comments
 (0)