@@ -171,26 +171,26 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
171171 const onDragEnd = useStableCallback (
172172 ( { from, to } : { from : number ; to : number } ) => {
173173 const { onDragEnd, data } = props ;
174- if ( onDragEnd ) {
175- const newData = [ ...data ] ;
176- if ( from !== to ) {
177- newData . splice ( from , 1 ) ;
178- newData . splice ( to , 0 , data [ from ] ) ;
179- }
180- const reset = ( ) => {
181- activeIndexAnim . value = - 1 ;
182- spacerIndexAnim . value = - 1 ;
183- touchTranslate . value = 0 ;
184- activeCellSize . value = - 1 ;
185- activeCellOffset . value = - 1 ;
186- setActiveKey ( null ) ;
187- } ;
188-
189- if ( isWeb ) reset ( ) ;
190- else setTimeout ( reset ) ;
191-
192- onDragEnd ( { from, to, data : newData } ) ;
174+
175+ const newData = [ ...data ] ;
176+ if ( from !== to ) {
177+ newData . splice ( from , 1 ) ;
178+ newData . splice ( to , 0 , data [ from ] ) ;
193179 }
180+
181+ const reset = ( ) => {
182+ activeIndexAnim . value = - 1 ;
183+ spacerIndexAnim . value = - 1 ;
184+ touchTranslate . value = 0 ;
185+ activeCellSize . value = - 1 ;
186+ activeCellOffset . value = - 1 ;
187+ setActiveKey ( null ) ;
188+ } ;
189+
190+ if ( isWeb ) reset ( ) ;
191+ else setTimeout ( reset ) ;
192+
193+ onDragEnd ?.( { from, to, data : newData } ) ;
194194 }
195195 ) ;
196196
0 commit comments