deanmcpherson / react-native-sortable-listview

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

isSorting bool #34

Closed benjick closed 6 years ago

benjick commented 8 years ago

Hey

Is there a way to get a prop down the row that signals if it's being dragged or not? Would want to do some more advanced stuff than just pass down a style

CaleyD commented 8 years ago

I have a need to disable stickyHeaderIndices while a row is being dragged. I've solved this for my need with a one-off copy of this component - but I think if I cleaned it up a bit I could submit a PR adding anRowPickedUp and onRowDropped events (except with better names) to the react-native-sortable-listview API - these would tell which row was picked up or dropped so you could then implement your custom logic on top of this component...

@deanmcpherson - would you be willing to accept a PR with these events? If so, do you have property names that you like? Should there be one prop (onRowInteractedWith({rowIndex, state,...}) or two (onRowPickedUp, onRowDropped)?

Thanks -Cal

CaleyD commented 8 years ago

Actually - we already have onRowMoved, adding onRowActivated (or a better name) that gets an argument with two properties - 'from' and 'row' - should give us what we need

benjick commented 8 years ago

@CaleyD could you show me how you did this? I need to do some animating on the row component

deanmcpherson commented 7 years ago

There are undocumented props available for onMoveStart and onMoveEnd which are called once the drag begins itself that you could use to approximate the desired functionality. @CaleyD I'd definitely accept a PR with something like onRowStart or onRowSortStart. I think two separate props would be cleaner.

dsernst commented 7 years ago

Came to suggest the same thing.

I'm having trouble doing more advanced styling of the active row. I need to adjust the style of a single element within the active row component, not just the container of the row.

An isSorting bool to renderRow would make this a lot simpler.

TLenahan commented 6 years ago

Is this still an issue @dsernst ? If you need a boolean passed to the active row, your renderRow function has 5 parameters, the last one being weather or not the row is currently the active row. See here

dsernst commented 6 years ago

Thanks for checking in. Because of resource constraints, we're no longer using RN 😕 Mobile web only for now.