File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
1010 FlatListProps ,
1111 NativeScrollEvent ,
1212 NativeSyntheticEvent ,
13+ LayoutChangeEvent ,
1314} from "react-native" ;
1415import {
1516 PanGestureHandler ,
@@ -147,15 +148,10 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
147148
148149 const autoScrollNode = useAutoScroll ( ) ;
149150
150- const onContainerLayout = ( ) => {
151- const containerNode = isReanimatedV2
152- ? containerRef . current
153- : containerRef . current ?. getNode ( ) ;
154-
155- //@ts -ignore
156- containerNode ?. measure ( ( _x , _y , w , h ) => {
157- containerSize . setValue ( props . horizontal ? w : h ) ;
158- } ) ;
151+ const onContainerLayout = ( {
152+ nativeEvent : { layout } ,
153+ } : LayoutChangeEvent ) => {
154+ containerSize . setValue ( props . horizontal ? layout . width : layout . height ) ;
159155 } ;
160156
161157 const onListContentSizeChange = ( w : number , h : number ) => {
@@ -193,7 +189,8 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
193189 const renderItem : ListRenderItem < T > = useCallback (
194190 ( { item, index } ) => {
195191 const key = keyExtractor ( item , index ) ;
196- if ( index !== keyToIndexRef . current . get ( key ) ) keyToIndexRef . current . set ( key , index ) ;
192+ if ( index !== keyToIndexRef . current . get ( key ) )
193+ keyToIndexRef . current . set ( key , index ) ;
197194
198195 return (
199196 < RowItem
You can’t perform that action at this time.
0 commit comments