File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -225,6 +225,10 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
225225 }
226226 ) ;
227227
228+ const onPlaceholderIndexChange = useStableCallback ( ( index : number ) => {
229+ props . onPlaceholderIndexChange ?.( index ) ;
230+ } ) ;
231+
228232 // Handle case where user ends drag without moving their finger.
229233 useAnimatedReaction (
230234 ( ) => {
@@ -245,6 +249,18 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
245249 [ isTouchActiveNative , onDragEnd ]
246250 ) ;
247251
252+ useAnimatedReaction (
253+ ( ) => {
254+ return spacerIndexAnim . value ;
255+ } ,
256+ ( cur , prev ) => {
257+ if ( cur !== prev && cur >= 0 && prev >= 0 ) {
258+ runOnJS ( onPlaceholderIndexChange ) ( cur )
259+ }
260+ } ,
261+ [ spacerIndexAnim ]
262+ ) ;
263+
248264 const gestureDisabled = useSharedValue ( false ) ;
249265
250266 const panGesture = Gesture . Pan ( )
You can’t perform that action at this time.
0 commit comments