@@ -183,6 +183,7 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
183183 set ( this . touchCellOffset , 0 ) ,
184184 set ( this . hoverAnimState . finished , 0 ) ,
185185 set ( this . hoverAnimState . velocity , 0 ) ,
186+ set ( this . hasMoved , 0 ) ,
186187 ]
187188
188189 keyToIndex = new Map < string , number > ( )
@@ -248,7 +249,6 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
248249 this . isPressedIn . js = true
249250 this . spacerIndex . setValue ( index )
250251 this . activeIndex . setValue ( index )
251- console . log ( 'setting active cell!!' , activeKey )
252252 this . activeCellSize . setValue ( this . cellData . get ( activeKey ) . size )
253253
254254 this . setState ( {
@@ -264,13 +264,11 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
264264
265265 onRelease = ( [ index ] : readonly number [ ] ) => {
266266 const { onRelease } = this . props
267- console . log ( 'ON RELEASE' , index )
268267 this . isPressedIn . js = false
269268 onRelease && onRelease ( index )
270269 }
271270
272271 onMoveEnd = ( [ from , to ] : readonly number [ ] ) => {
273- console . log ( `move from ${ from } to ${ to } ` )
274272 const { onMoveEnd } = this . props
275273 if ( onMoveEnd ) {
276274 const { data } = this . props
@@ -285,7 +283,6 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
285283
286284 const lo = Math . min ( from , to ) - 1
287285 const hi = Math . max ( from , to ) + 1
288- console . log ( `OME measure: lo ${ lo } hi ${ hi } ` )
289286 for ( let i = lo ; i < hi ; i ++ ) {
290287 this . queue . push ( ( ) => {
291288 const item = this . props . data [ i ]
@@ -372,13 +369,13 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
372369
373370 const onChangeTranslate = onChange ( translate , [
374371 set ( this . hoverScrollSnapshot , this . scrollOffset ) ,
375- set ( this . hoverTo ,
376- cond ( isAfterActive , cond ( isShifted , [ sub ( cellStart , size ) ] , [ cellStart ] ) , [
377- cond ( isShifted , [ cellStart ] , [ add ( cellStart , size ) ] )
378- ] )
379- ) ,
380372 cond ( not ( this . hasMoved ) , set ( state . position , translate ) ) ,
381373 cond ( this . hasMoved , [
374+ set ( this . hoverTo ,
375+ cond ( isAfterActive , cond ( isShifted , [ sub ( cellStart , size ) ] , [ cellStart ] ) , [
376+ cond ( isShifted , [ cellStart ] , [ add ( cellStart , size ) ] )
377+ ] )
378+ ) ,
382379 cond ( and (
383380 not ( isAfterActive ) ,
384381 greaterThan ( translate , 0 )
@@ -434,17 +431,13 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
434431 cond ( and (
435432 neq ( state , tapState ) ,
436433 not ( this . disabled ) ,
437- )
438- , [
434+ ) , [
439435 set ( tapState , state ) ,
440- call ( [ tapState ] , ( [ st ] ) => debugGestureState ( st , 'TAP' ) ) ,
441436 cond ( eq ( state , GestureState . BEGAN ) , [
437+ set ( this . hoverTo , sub ( offset , this . scrollOffset ) ) ,
442438 set ( this . touchCellOffset , this . props . horizontal ? x : y ) ,
443439 ] ) ,
444- cond ( eq ( state , GestureState . END ) , [
445- call ( [ tapState ] , ( [ st ] ) => debugGestureState ( st , "END TAP" ) ) ,
446- this . onGestureRelease
447- ] )
440+ cond ( eq ( state , GestureState . END ) , this . onGestureRelease )
448441 ]
449442 )
450443 ] )
@@ -510,7 +503,7 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
510503 onContainerLayout = ( ) => {
511504 const { horizontal } = this . props
512505 this . containerRef . current . _component . measure ( ( x , y , w , h , pageX , pageY ) => {
513- console . log ( `container layout x ${ x } y ${ y } w ${ w } h ${ h } pageX ${ pageX } pageY ${ pageY } ` )
506+ // console.log(`container layout x ${x} y ${y} w ${w} h ${h} pageX ${pageX} pageY ${pageY}`)
514507 this . containerOffset . setValue ( horizontal ? pageX : pageY )
515508 this . containerEnd . setValue ( add ( this . containerOffset , horizontal ? w : h ) )
516509 } )
@@ -554,13 +547,15 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
554547 isScrolledDown : boolean ,
555548 ) => {
556549 if ( this . isAutoscrolling . js ) return - 1
557- const { autoscrollThreshold } = this . props
550+ const { autoscrollThreshold, autoScrollSpeed } = this . props
558551 const scrollUp = distFromTop < autoscrollThreshold
559552 const scrollDown = distFromBottom < autoscrollThreshold
560553 if ( ! ( scrollUp || scrollDown ) || scrollUp && isScrolledUp || scrollDown && isScrolledDown ) return - 1
561554 const distFromEdge = scrollUp ? distFromTop : distFromBottom
562555 const speedPct = 1 - ( distFromEdge / autoscrollThreshold )
563- const offset = speedPct * this . props . autoScrollSpeed
556+ // Android scroll speed seems much faster than ios
557+ const speed = Platform . OS === "ios" ? autoScrollSpeed : autoScrollSpeed / 10
558+ const offset = speedPct * speed
564559 const targetOffset = scrollUp ? Math . max ( 0 , scrollOffset - offset ) : scrollOffset + offset
565560 return targetOffset
566561 }
@@ -647,7 +642,6 @@ class DraggableFlatList<T> extends React.Component<Props<T>, State> {
647642 ] )
648643
649644 onGestureRelease = [
650- set ( this . hasMoved , 0 ) ,
651645 cond ( this . isHovering , [
652646 set ( this . disabled , 1 ) ,
653647 cond ( defined ( this . hoverClock ) , [
0 commit comments