Skip to content

Commit 1ac3d11

Browse files
committed
null check
1 parent a98fc87 commit 1ac3d11

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/DraggableFlatList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,16 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
246246
}
247247
}
248248
},
249-
[isTouchActiveNative, onDragEnd]
249+
[isTouchActiveNative, onDragEnd, onRelease]
250250
);
251251

252252
useAnimatedReaction(
253253
() => {
254254
return spacerIndexAnim.value;
255255
},
256256
(cur, prev) => {
257-
if (cur !== prev && cur >= 0 && prev >= 0) {
258-
runOnJS(onPlaceholderIndexChange)(cur)
257+
if (prev !== null && cur !== prev && cur >= 0 && prev >= 0) {
258+
runOnJS(onPlaceholderIndexChange)(cur);
259259
}
260260
},
261261
[spacerIndexAnim]

0 commit comments

Comments
 (0)