diff --git a/package-lock.json b/package-lock.json index c4be70920bca..15dac63be528 100644 --- a/package-lock.json +++ b/package-lock.json @@ -95,7 +95,7 @@ "react-native-collapsible": "^1.6.2", "react-native-config": "1.5.3", "react-native-device-info": "10.3.1", - "react-native-draggable-flatlist": "^4.0.1", + "react-native-draggable-flatlist": "^4.0.3", "react-native-fs": "^2.20.0", "react-native-gesture-handler": "2.25.0", "react-native-google-places-autocomplete": "2.5.6", @@ -32493,7 +32493,9 @@ } }, "node_modules/react-native-draggable-flatlist": { - "version": "4.0.1", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/react-native-draggable-flatlist/-/react-native-draggable-flatlist-4.0.3.tgz", + "integrity": "sha512-2F4x5BFieWdGq9SetD2nSAR7s7oQCSgNllYgERRXXtNfSOuAGAVbDb/3H3lP0y5f7rEyNwabKorZAD/SyyNbDw==", "license": "MIT", "dependencies": { "@babel/preset-typescript": "^7.17.12" diff --git a/package.json b/package.json index 0751e754bb4c..c561a2ba224c 100644 --- a/package.json +++ b/package.json @@ -164,7 +164,7 @@ "react-native-collapsible": "^1.6.2", "react-native-config": "1.5.3", "react-native-device-info": "10.3.1", - "react-native-draggable-flatlist": "^4.0.1", + "react-native-draggable-flatlist": "^4.0.3", "react-native-fs": "^2.20.0", "react-native-gesture-handler": "2.25.0", "react-native-google-places-autocomplete": "2.5.6", diff --git a/patches/react-native-draggable-flatlist+4.0.1+001+initial.patch b/patches/react-native-draggable-flatlist+4.0.1+001+initial.patch deleted file mode 100644 index a3d29b66de7a..000000000000 --- a/patches/react-native-draggable-flatlist+4.0.1+001+initial.patch +++ /dev/null @@ -1,92 +0,0 @@ -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..dc6b095 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,7 @@ function useSetupRefs({ - ...DEFAULT_PROPS.animationConfig, - ...animationConfig, - } as WithSpringConfig; -- const animationConfigRef = useRef(animConfig); -- animationConfigRef.current = animConfig; -+ const animationConfigRef = useSharedValue(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; -diff --git a/node_modules/react-native-draggable-flatlist/src/hooks/useOnCellActiveAnimation.ts b/node_modules/react-native-draggable-flatlist/src/hooks/useOnCellActiveAnimation.ts -index 7c20587..33042e9 100644 ---- a/node_modules/react-native-draggable-flatlist/src/hooks/useOnCellActiveAnimation.ts -+++ b/node_modules/react-native-draggable-flatlist/src/hooks/useOnCellActiveAnimation.ts -@@ -1,8 +1,9 @@ --import { useRef } from "react"; --import Animated, { -+ -+import { - useDerivedValue, - withSpring, - WithSpringConfig, -+ useSharedValue, - } from "react-native-reanimated"; - import { DEFAULT_ANIMATION_CONFIG } from "../constants"; - import { useAnimatedValues } from "../context/animatedValueContext"; -@@ -15,8 +16,7 @@ type Params = { - export function useOnCellActiveAnimation( - { animationConfig }: Params = { animationConfig: {} } - ) { -- const animationConfigRef = useRef(animationConfig); -- animationConfigRef.current = animationConfig; -+ const animationConfigRef = useSharedValue(animationConfig); - - const isActive = useIsActive(); - -@@ -26,7 +26,7 @@ export function useOnCellActiveAnimation( - const toVal = isActive && isTouchActiveNative.value ? 1 : 0; - return withSpring(toVal, { - ...DEFAULT_ANIMATION_CONFIG, -- ...animationConfigRef.current, -+ ...animationConfigRef.value, - }); - }, [isActive]); - diff --git a/patches/react-native-draggable-flatlist/details.md b/patches/react-native-draggable-flatlist/details.md new file mode 100644 index 000000000000..8afd4dc971c9 --- /dev/null +++ b/patches/react-native-draggable-flatlist/details.md @@ -0,0 +1,16 @@ +# `react-native-draggable-flatlist` patches + +### [react-native-draggable-flatlist+4.0.3+001+listfooter-constraint.patch](react-native-draggable-flatlist+4.0.3+001+listfooter-constraint.patch) + +- Reason: Ensures items can't be dragged into the list footer by accounting for its height when constraining drag bounds. +- Upstream PR/issue: https://github.com/computerjazz/react-native-draggable-flatlist/pull/592 +- E/App issue: 🛑 +- PR Introducing Patch: [#61380](https://github.com/Expensify/App/pull/61380) + + +### [react-native-draggable-flatlist+4.0.3+002+fix-console-error-ref-measureLayout.patch](react-native-draggable-flatlist+4.0.3+002+fix-console-error-ref-measureLayout.patch) + +- Reason: Prevents console warning when adding a new item due to incorrect `ref.measureLayout` call. +- Upstream PR/issue: https://github.com/computerjazz/react-native-draggable-flatlist/pull/544 +- E/App issue: 🛑 +- PR Introducing Patch: [#55066](https://github.com/Expensify/App/pull/55066) diff --git a/patches/react-native-draggable-flatlist+4.0.1+001+listfooter-constraint.patch b/patches/react-native-draggable-flatlist/react-native-draggable-flatlist+4.0.3+001+listfooter-constraint.patch similarity index 100% rename from patches/react-native-draggable-flatlist+4.0.1+001+listfooter-constraint.patch rename to patches/react-native-draggable-flatlist/react-native-draggable-flatlist+4.0.3+001+listfooter-constraint.patch diff --git a/patches/react-native-draggable-flatlist+4.0.1+002+fix-console-error-ref-measureLayout.patch b/patches/react-native-draggable-flatlist/react-native-draggable-flatlist+4.0.3+002+fix-console-error-ref-measureLayout.patch similarity index 100% rename from patches/react-native-draggable-flatlist+4.0.1+002+fix-console-error-ref-measureLayout.patch rename to patches/react-native-draggable-flatlist/react-native-draggable-flatlist+4.0.3+002+fix-console-error-ref-measureLayout.patch