diff --git a/node_modules/react-native-draggable-flatlist/src/components/DraggableFlatList.tsx b/node_modules/react-native-draggable-flatlist/src/components/DraggableFlatList.tsx index d7d98c2..2f59c7a 100644 --- a/node_modules/react-native-draggable-flatlist/src/components/DraggableFlatList.tsx +++ b/node_modules/react-native-draggable-flatlist/src/components/DraggableFlatList.tsx @@ -295,7 +295,7 @@ function DraggableFlatListInner(props: DraggableFlatListProps) { const springTo = placeholderOffset.value - activeCellOffset.value; touchTranslate.value = withSpring( springTo, - animationConfigRef.current, + animationConfigRef.value, () => { runOnJS(onDragEnd)({ from: activeIndexAnim.value, diff --git a/node_modules/react-native-draggable-flatlist/src/context/refContext.tsx b/node_modules/react-native-draggable-flatlist/src/context/refContext.tsx index ea21575..66c5eed 100644 --- a/node_modules/react-native-draggable-flatlist/src/context/refContext.tsx +++ b/node_modules/react-native-draggable-flatlist/src/context/refContext.tsx @@ -1,14 +1,14 @@ import React, { useContext } from "react"; import { useMemo, useRef } from "react"; import { FlatList } from "react-native-gesture-handler"; -import Animated, { WithSpringConfig } from "react-native-reanimated"; +import Animated, { type SharedValue, useSharedValue, WithSpringConfig } from "react-native-reanimated"; import { DEFAULT_PROPS } from "../constants"; import { useProps } from "./propsContext"; import { CellData, DraggableFlatListProps } from "../types"; type RefContextValue = { propsRef: React.MutableRefObject>; - animationConfigRef: React.MutableRefObject; + animationConfigRef: SharedValue; cellDataRef: React.MutableRefObject>; keyToIndexRef: React.MutableRefObject>; containerRef: React.RefObject; @@ -54,8 +54,8 @@ function useSetupRefs({ ...DEFAULT_PROPS.animationConfig, ...animationConfig, } as WithSpringConfig; - const animationConfigRef = useRef(animConfig); - animationConfigRef.current = animConfig; + const animationConfigRef = useSharedValue(animConfig); + animationConfigRef.value = animConfig; const cellDataRef = useRef(new Map()); const keyToIndexRef = useRef(new Map()); diff --git a/node_modules/react-native-draggable-flatlist/src/hooks/useCellTranslate.tsx b/node_modules/react-native-draggable-flatlist/src/hooks/useCellTranslate.tsx index ce4ab68..efea240 100644 --- a/node_modules/react-native-draggable-flatlist/src/hooks/useCellTranslate.tsx +++ b/node_modules/react-native-draggable-flatlist/src/hooks/useCellTranslate.tsx @@ -101,7 +101,7 @@ export function useCellTranslate({ cellIndex, cellSize, cellOffset }: Params) { ? activeCellSize.value * (isAfterActive ? -1 : 1) : 0; - return withSpring(translationAmt, animationConfigRef.current); + return withSpring(translationAmt, animationConfigRef.value); }, [activeKey, cellIndex]); return translate;