fivecar/react-native-draglist

Problem on dragging selected item

moloudayat opened this issue ยท 9 comments

Hi, I hope you are doing good!
I have a problem with react-native: 0.63.4. when I added your example to my project and tried to test it, the selected item was not in the correct position. This happened on both the Android emulator and the real device.

Screen.Recording.2024-03-26.at.1.36.36.PM.mov

I have the exact same problem. Using Expo Router for navigation, looks like it offset by the exact height of top header.

I'm also having this issue on both iOS & Android (RN 0.72.9)
Looks like the problem was introduced with version 3.6.0 as regressing to 3.5.1 fixes this on both platforms.
Possibly related to #32 which seems to be a 'fix' for a very similar issue.

I also have this problem, and i found that making slight change on panResponder fixed it for me,

 onPanResponderGrant: (_, gestate) => {
        if (props.horizontal) {
          pan.setValue(gestate.dx);
        } else {
          pan.setValue(gestate.dy);
        }
        panGrantedRef.current = true;

        flatWrapRef.current?.measure((_x, _y, _width, _height, pageX, pageY) => {
          flatWrapLayout.current = {
            ...flatWrapLayout.current,
            pos: props.horizontal ? pageX : pageY,
          };
        });

        onDragBegin?.();
      },

The pageX and pageY are last parameters we get from measure()

I'm also having this issue - is there a fix for it? I'm using 3.6.0 (downgrading to 3.5.1 fixed for me too)

I'm also having this issue - is there a fix for it? I'm using 3.6.0 (downgrading to 3.5.1 fixed for me too)

 flatWrapRef.current?.measure((_x, _y, _width, _height, pageX, pageY) => {
          flatWrapLayout.current = {
            ...flatWrapLayout.current,
            pos: props.horizontal ? pageX : pageY,
          };
        });

i think this change is required in v3.6.0 in panResponder -> onPanResponderGrant ...

I'm also having this issue - is there a fix for it? I'm using 3.6.0 (downgrading to 3.5.1 fixed for me too)

 flatWrapRef.current?.measure((_x, _y, _width, _height, pageX, pageY) => {
          flatWrapLayout.current = {
            ...flatWrapLayout.current,
            pos: props.horizontal ? pageX : pageY,
          };
        });

i think this change is required in v3.6.0 in panResponder -> onPanResponderGrant ...

Hello can you please direct me where to make these changes ๐Ÿ˜…

I'm also having this issue - is there a fix for it? I'm using 3.6.0 (downgrading to 3.5.1 fixed for me too)

 flatWrapRef.current?.measure((_x, _y, _width, _height, pageX, pageY) => {
          flatWrapLayout.current = {
            ...flatWrapLayout.current,
            pos: props.horizontal ? pageX : pageY,
          };
        });

i think this change is required in v3.6.0 in panResponder -> onPanResponderGrant ...

Hello can you please direct me where to make these changes ๐Ÿ˜…

Hi!, it should be here ->

flatWrapRef.current?.measure((pageX, pageY) => {

Thanks to @MarkHaakman for #42, which fixes this. Released as 3.6.1. Thanks, everyone!

This issue is still not fixed. I have 3 DragLists nested in FlatList.
It seems to work at initial position, but It doesn't work as expected after scroll.