Drag starts on press instead of long press
See original GitHub issueHi, I’m trying to use this library to create a scrollable SectionList. So far I can drag the section headers and the items, but I have a problem because the drag starts as soon as I touch the screen i.e. on press instead of long press, so I can’t scroll the list unless I comment out “onDragStart={() => {console.log(“drag item”);}}”
The drag is supposed to start on long press by default. How do I force that? Any workarounds?
If I use DraxView on a smaller part of the UI e.g. an icon or image in the section or list item, that fixes the problem, but then the UI of what gets dragged is just the icon or image instead of the entire section or list item. Is there a way to specify the UI that gets dragged?
Note: It would also be nice to be able to drag the whole section UI, and not just the section header, but I tried that and it didn’t work. I used nested DraxViews.
Using: “react-native”: “0.68.2”, “react-native-gesture-handler”: “~2.2.1”,
The basic structure is:
<DraxProvider>
<View>
<DraxScrollView>
{this.props.Items.map((section) => (
<View>
<DraxView payload={section} onDragStart={() => {console.log("drag section");}}>
<Text>{section.Title}</Text>
</Draxview>
{section.map((item) => (
<DraxView payload={item} onDragStart={() => {console.log("drag item");}}>
<Text>{item.Title}</Text>
</Draxview>
))}
</View>
))}
<DraxScrollView>
<View>
</DraxProvider>
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)
@lafiosca Thanks,
DraxSnapbackTargetPreset.None
works!. I did notice one other issue. The first few drag drops work correctly, but then the drag image initial display location is not over the image being dragged, but 100-200 pixels above or below it. This fixes itself if I refresh the screen (e.g. navigate away and back).If this offset behavior is consistently wrong and can be reproduced in a simple project or snack, please open a separate issue to track it. (I don’t want to get your hopes up though, as I will not personally have time to look into it… but at least if there is an issue open, people can be aware and someone may investigate further.)