-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating yarn, patching react-native-draggable-flatlist per computerj…
- Loading branch information
1 parent
15db8eb
commit 08f55e7
Showing
7 changed files
with
1,091 additions
and
1,121 deletions.
There are no files selected for viewing
122 changes: 122 additions & 0 deletions
122
.yarn/patches/react-native-draggable-flatlist-npm-4.0.1-4a95e98e27.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
diff --git a/react-native-draggable-flatlist+4.0.1.patch.txt b/react-native-draggable-flatlist+4.0.1.patch.txt | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..a4c89a29a71285e8d058aef96d9604afca29c905 | ||
--- /dev/null | ||
+++ b/react-native-draggable-flatlist+4.0.1.patch.txt | ||
@@ -0,0 +1,58 @@ | ||
+diff --git a/src/components/DraggableFlatList.tsx b/node_modules/react-native-draggable-flatlist/src/components/DraggableFlatList.tsx | ||
+index d7d98c2..2f59c7a 100644 | ||
+--- a/src/components/DraggableFlatList.tsx | ||
++++ b/src/components/DraggableFlatList.tsx | ||
+@@ -295,7 +295,7 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) { | ||
+ const springTo = placeholderOffset.value - activeCellOffset.value; | ||
+ touchTranslate.value = withSpring( | ||
+ springTo, | ||
+- animationConfigRef.current, | ||
++ animationConfigRef.value, | ||
+ () => { | ||
+ runOnJS(onDragEnd)({ | ||
+ from: activeIndexAnim.value, | ||
+diff --git a/src/context/refContext.tsx b/node_modules/react-native-draggable-flatlist/src/context/refContext.tsx | ||
+index ea21575..66c5eed 100644 | ||
+--- a/src/context/refContext.tsx | ||
++++ b/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<T> = { | ||
+ propsRef: React.MutableRefObject<DraggableFlatListProps<T>>; | ||
+- animationConfigRef: React.MutableRefObject<WithSpringConfig>; | ||
++ animationConfigRef: SharedValue<WithSpringConfig>; | ||
+ cellDataRef: React.MutableRefObject<Map<string, CellData>>; | ||
+ keyToIndexRef: React.MutableRefObject<Map<string, number>>; | ||
+ containerRef: React.RefObject<Animated.View>; | ||
+@@ -54,8 +54,8 @@ function useSetupRefs<T>({ | ||
+ ...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<string, CellData>()); | ||
+ const keyToIndexRef = useRef(new Map<string, number>()); | ||
+diff --git a/src/hooks/useCellTranslate.tsx b/node_modules/react-native-draggable-flatlist/src/hooks/useCellTranslate.tsx | ||
+index ce4ab68..efea240 100644 | ||
+--- a/src/hooks/useCellTranslate.tsx | ||
++++ b/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/src/components/DraggableFlatList.tsx b/src/components/DraggableFlatList.tsx | ||
index d7d98c2796afb69bb46aa21f0ece8c5ec9f2a339..2f59c7a2e544a183b4f501dadbf79df76cc4ccf3 100644 | ||
--- a/src/components/DraggableFlatList.tsx | ||
+++ b/src/components/DraggableFlatList.tsx | ||
@@ -295,7 +295,7 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) { | ||
const springTo = placeholderOffset.value - activeCellOffset.value; | ||
touchTranslate.value = withSpring( | ||
springTo, | ||
- animationConfigRef.current, | ||
+ animationConfigRef.value, | ||
() => { | ||
runOnJS(onDragEnd)({ | ||
from: activeIndexAnim.value, | ||
diff --git a/src/context/refContext.tsx b/src/context/refContext.tsx | ||
index ea21575c9d91d45634dc3371536ab80470413401..66c5eed6775613c2f4b92c4c742e68a1f67e4291 100644 | ||
--- a/src/context/refContext.tsx | ||
+++ b/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<T> = { | ||
propsRef: React.MutableRefObject<DraggableFlatListProps<T>>; | ||
- animationConfigRef: React.MutableRefObject<WithSpringConfig>; | ||
+ animationConfigRef: SharedValue<WithSpringConfig>; | ||
cellDataRef: React.MutableRefObject<Map<string, CellData>>; | ||
keyToIndexRef: React.MutableRefObject<Map<string, number>>; | ||
containerRef: React.RefObject<Animated.View>; | ||
@@ -54,8 +54,8 @@ function useSetupRefs<T>({ | ||
...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<string, CellData>()); | ||
const keyToIndexRef = useRef(new Map<string, number>()); | ||
diff --git a/src/hooks/useCellTranslate.tsx b/src/hooks/useCellTranslate.tsx | ||
index ce4ab68ab7ebe6abdfdfb24141b0d7fb1ae1e75a..efea24038ffa1b340b601cea16588ed1a5823e5a 100644 | ||
--- a/src/hooks/useCellTranslate.tsx | ||
+++ b/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; |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.