deanmcpherson / react-native-sortable-listview

Drag drop capable wrapper of ListView for React Native
MIT License
918 stars 235 forks source link

Not working when it is nested inside a ScrollView? #38

Open joonhocho opened 8 years ago

joonhocho commented 8 years ago

I am currently testing out this lib. Great work by the way, but it doesn't seem to work when nested inside a ScrollView. It works fine without parent ScrollView though. My use case is that there are multiple sortable lists in one screen divided into different sections.

danleveille commented 8 years ago

@joonhocho Did you ever find a solution to this issue? I'm having the same problem.

joonhocho commented 8 years ago

@danleveille I'm sorry, but no. I ended up using one sortable list per screen for the time being.

deanmcpherson commented 8 years ago

Hey @joonhocho, sorry for the VERY late reply. This probably won't work. You could potentially track when the drag begins / stops and set scrollEnabled={false} on the parent ScrollView? However, the parent scroll view won't automatically scroll if this does work.

TheSisb commented 8 years ago

A couple tricks I used to get around this issue for different use cases are: 1- Using a ListView header renderHeader={() => this.props.header} 2- Pressing an Edit button would change the original view into this component and hide everything else (including the original scrollview)

deanmcpherson commented 8 years ago

Thanks @TheSisb. This kind of functionality would need some serious changes to the code, and a lot of thought. Would adding section support to the scrollview achieve this? And preventing drag / drop between sections?

TheSisb commented 8 years ago

For case 1 (header), I do it in my fork here: https://github.com/hammerandchisel/react-native-sortable-listview/blob/master/index.js

For case 2 - I don't think it's the responsibility of this lib to handle. The user's app should handle it.

It would be cool if this lib prevented drag/drop between sections 👍 . Right now on edit, I simply hide everything except the editable (drag/drop) items.

kylanhurt commented 7 years ago

I think I am just going to make it so that there are two sections, each with a header and their own sortable-listview but only one section can be open at a time. Not a perfect solution but that way there is only ever one scrollable area at a time, and each has a header. Opening one will cause the other to close, etc.

adriennealyzee commented 7 years ago

SortableListView also doesn't appear to work when its nested inside any type of nested view.