File tree Expand file tree Collapse file tree 2 files changed +13
-15
lines changed
Expand file tree Collapse file tree 2 files changed +13
-15
lines changed Original file line number Diff line number Diff line change 44 LayoutChangeEvent ,
55 MeasureLayoutOnSuccessCallback ,
66 StyleProp ,
7- StyleSheet ,
87 ViewStyle ,
98} from "react-native" ;
109import Animated , {
@@ -163,11 +162,7 @@ function CellRendererComponent<T>(props: Props<T>) {
163162 ? itemLayoutAnimation
164163 : undefined
165164 }
166- style = { [
167- props . style ,
168- baseStyle ,
169- activeKey ? animStyle : styles . zeroTranslate ,
170- ] }
165+ style = { [ props . style , baseStyle , animStyle ] }
171166 pointerEvents = { activeKey ? "none" : "auto" }
172167 >
173168 < CellProvider isActive = { isActive } > { children } </ CellProvider >
@@ -177,12 +172,6 @@ function CellRendererComponent<T>(props: Props<T>) {
177172
178173export default typedMemo ( CellRendererComponent ) ;
179174
180- const styles = StyleSheet . create ( {
181- zeroTranslate : {
182- transform : [ { translateX : 0 } , { translateY : 0 } ] ,
183- } ,
184- } ) ;
185-
186175declare global {
187176 namespace NodeJS {
188177 interface Global {
Original file line number Diff line number Diff line change @@ -6,7 +6,12 @@ import React, {
66 useRef ,
77 useState ,
88} from "react" ;
9- import { ListRenderItem , FlatListProps , LayoutChangeEvent } from "react-native" ;
9+ import {
10+ ListRenderItem ,
11+ FlatListProps ,
12+ LayoutChangeEvent ,
13+ InteractionManager ,
14+ } from "react-native" ;
1015import {
1116 FlatList ,
1217 Gesture ,
@@ -20,7 +25,7 @@ import Animated, {
2025 withSpring ,
2126} from "react-native-reanimated" ;
2227import CellRendererComponent from "./CellRendererComponent" ;
23- import { DEFAULT_PROPS , isWeb } from "../constants" ;
28+ import { DEFAULT_PROPS } from "../constants" ;
2429import PlaceholderItem from "./PlaceholderItem" ;
2530import RowItem from "./RowItem" ;
2631import { DraggableFlatListProps } from "../types" ;
@@ -114,6 +119,9 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
114119 if ( dataHasChanged ) {
115120 // When data changes make sure `activeKey` is nulled out in the same render pass
116121 activeKey = null ;
122+ InteractionManager . runAfterInteractions ( ( ) => {
123+ reset ( ) ;
124+ } ) ;
117125 }
118126
119127 useEffect ( ( ) => {
@@ -221,7 +229,8 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
221229 }
222230
223231 onDragEnd ?.( { from, to, data : newData } ) ;
224- reset ( ) ;
232+
233+ setActiveKey ( null ) ;
225234 }
226235 ) ;
227236
You can’t perform that action at this time.
0 commit comments