@@ -21,6 +21,7 @@ import Animated, {
2121 withSpring ,
2222 interpolate ,
2323 Extrapolate ,
24+ WithSpringConfig ,
2425} from "react-native-reanimated" ;
2526
2627export enum OpenDirection {
@@ -71,7 +72,7 @@ type Props<T> = {
7172 renderUnderlayRight ?: RenderUnderlay < T > ;
7273 onChange ?: ( params : { open : OpenDirection ; snapPoint : number } ) => void ;
7374 overSwipe ?: number ;
74- animationConfig ?: Partial < Animated . WithSpringConfig > ;
75+ animationConfig ?: Partial < WithSpringConfig > ;
7576 activationThreshold ?: number ;
7677 swipeEnabled ?: boolean ;
7778 snapPointsLeft ?: number [ ] ;
@@ -104,7 +105,7 @@ function SwipeableItem<T>(
104105 animationConfig = { } ,
105106 } = props ;
106107
107- const springConfig : Animated . WithSpringConfig = {
108+ const springConfig : WithSpringConfig = {
108109 damping : 20 ,
109110 mass : 0.2 ,
110111 stiffness : 100 ,
@@ -186,7 +187,9 @@ function SwipeableItem<T>(
186187 snapPoint ?? maxSnapPointLeft ,
187188 springConfig ,
188189 ( isFinished ) => {
189- runOnJS ( resolvePromiseIfFinished ) ( isFinished ) ;
190+ if ( isFinished ) {
191+ runOnJS ( resolvePromiseIfFinished ) ( isFinished ) ;
192+ }
190193 }
191194 ) ;
192195 } ) ;
@@ -200,7 +203,9 @@ function SwipeableItem<T>(
200203 snapPoint ?? maxSnapPointRight ,
201204 springConfig ,
202205 ( isFinished ) => {
203- runOnJS ( resolvePromiseIfFinished ) ( isFinished ) ;
206+ if ( isFinished ) {
207+ runOnJS ( resolvePromiseIfFinished ) ( isFinished ) ;
208+ }
204209 }
205210 ) ;
206211 } ) ;
@@ -212,7 +217,9 @@ function SwipeableItem<T>(
212217 if ( isFinished ) resolve ( ) ;
213218 }
214219 animStatePos . value = withSpring ( 0 , springConfig , ( isFinished ) => {
215- runOnJS ( resolvePromiseIfFinished ) ( isFinished ) ;
220+ if ( isFinished ) {
221+ runOnJS ( resolvePromiseIfFinished ) ( isFinished ) ;
222+ }
216223 } ) ;
217224 } ) ;
218225 }
0 commit comments