react-native-draggable-flatlist icon indicating copy to clipboard operation
react-native-draggable-flatlist copied to clipboard

NestableScrollContainer auto scrolls up when NestableDraggableFlatList is not the immediate child

Open jaaywags opened this issue 8 months ago • 5 comments

Describe the bug I have a NestableScrollContainer component wrapping multiple NestableDraggableFlatList components. If the NestableDraggableFlatList are not the first descendent (i.e. they are wrapped in a View) then when you press and hold on an item, the screen auto scrolls up.

To Reproduce Here is a demo.

I put everything in the ListOfDraggableItems.js

Platform & Dependencies Happens on both iOS and Android

Additional context Here is a demo. You can't really see my touches, but when I tap and hold an Item, I am NOT moving my finger. So the screen should not scroll. But it does.

https://github.com/user-attachments/assets/31e9ef2d-55d6-4038-9174-08a01f0b20a2

jaaywags avatar Apr 25 '25 02:04 jaaywags

Same issue here, any updates on that?

maciejewiczow avatar Aug 24 '25 09:08 maciejewiczow

Same issue here. Were you able to resolve it?

Code-yWilliams avatar Sep 30 '25 16:09 Code-yWilliams

Same issue here. Were you able to resolve it?

~~I think I fixed it by utilizing onDragBegin and onDragEnd. Something like this~~

<NestableDraggableFlatList
    data={data}
    onDragBegin={index => {
      setDisableParentScrollView(true);
    }}
    onDragEnd={({ data }) => {
      setDisableParentScrollView(false);
    }}

Actually, ignore that. I do use these but I just used multiple NestableScrollContainer comoponents. One for each NestableDraggableFlatList and I moved the other Text and View components to be parents. Like this

<View>
  <Text>Something</Text>
  <NestableScrollContainer>
    <NestableDraggableFlatList>
      ...
    </NestableDraggableFlatList>
  </NestableScrollContainer>
</View>

jaaywags avatar Sep 30 '25 16:09 jaaywags

@Code-yWilliams I updated my expo snack. Check out the WorkAroundListOfDraggableItems.js file. That works pretty well.

jaaywags avatar Sep 30 '25 16:09 jaaywags

@jaaywags Solid workaround! I suppose the only downside is that if you're trying to move an item to a position that is currently off screen, the parent is unable to scroll it into view for us to place it there. Not a huge deal but depends on the use case I suppose. Thanks for sharing!

Code-yWilliams avatar Sep 30 '25 17:09 Code-yWilliams