Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SortableListView inside ScrollView #23

Closed
superandrew213 opened this issue Jul 4, 2016 · 13 comments
Closed

SortableListView inside ScrollView #23

superandrew213 opened this issue Jul 4, 2016 · 13 comments

Comments

@superandrew213
Copy link

Is the there a way to get this to work? Currently it does not allow sorting. You can select the cell but it doesn't move. Just scrolls the parent ScrollView instead.

@superandrew213
Copy link
Author

onRowMoved is not being triggered

@superandrew213
Copy link
Author

Related to this #1046

@deanmcpherson
Copy link
Owner

Hey @superandrew213, do you have an example of how to reproduce this?

@superandrew213
Copy link
Author

@deanmcpherson I changed my approach and am not using the parent ScrollView anymore but it was basically like this:

<ScrollView>
  <SortableListView />
</ScrollView>

@deanmcpherson
Copy link
Owner

Hey @superandrew213, I don't think this is possible. I think you would need to disable the scroll of the scroll view for the sortable to be able to capture the move responder. You could try adding onMoveShouldSetPanResponder={true} to the PanResponder, but my suspicion is that on moving the parent scrollview will capture the event regardless.

@superandrew213
Copy link
Author

@deanmcpherson I found a workaround by disabling the parent ScrollView onPanResponderGrant then enable onPanResponderRelease

@deanmcpherson
Copy link
Owner

Just out of curiosity, why are you nesting it inside a ScrollView?

@superandrew213
Copy link
Author

My sortable list will only have 4 items and I have other content underneath it.

@deanmcpherson
Copy link
Owner

Ah ok, and you need it all to scroll. The content below is pretty big? Otherwise you could just render it in renderFooter.

@superandrew213
Copy link
Author

Yeah it's quite big and includes other non sortable lists. I might try and see how it performs if I include it in renderFooter. It might rerender every time SortableListView updates

@deanmcpherson
Copy link
Owner

Yep, by default it will try and rerender every time the SortableListView updates, you can wrap it in a StaticRenderer or return false to shouldComponentUpdate to fix that though.

@deanmcpherson
Copy link
Owner

Closing issue.

@vTrip
Copy link

vTrip commented Feb 7, 2018

Found rendering elements in the header an footer very useful when wanting all content to scroll with the list and not trigger the drag. Thanks @deanmcpherson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants