nuclearpasta / react-native-drax

A drag-and-drop system for React Native
MIT License
554 stars 69 forks source link

row instead of column? #111

Open consciousweb opened 3 years ago

consciousweb commented 3 years ago

Is it possible to set drax for a sortable list with a wrapped flex row of items instead of a column?

lafiosca commented 3 years ago

Do you mean the horizontal prop to DraxList or something more complex?

consciousweb commented 3 years ago

@lafiosca i want it to flex wrap, so after a certain number of columns, it creates a new row

lafiosca commented 3 years ago

Hmm is it possible #99 could support this, if we manage to get it merged?

consciousweb commented 3 years ago

It would certainly be an improvement. Otherwise the ability to directly style the list would at least be helpful

On Sun, Sep 12, 2021 at 3:50 AM Joe Lafiosca @.***> wrote:

Hmm is it possible #99 https://github.com/nuclearpasta/react-native-drax/pull/99 could support this, if we manage to get it merged?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nuclearpasta/react-native-drax/issues/111#issuecomment-917602528, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLFB3LYNWDKYXETKX5BK3LUBRZVVANCNFSM5D2BZOFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

lafiosca commented 3 years ago

Any props you pass to DraxList that it does not consume are passed to the underlying Flatlist. I’m not sure if that helps.

consciousweb commented 3 years ago

nothing i pass to the style prop of draxlist is reflected at render.

lafiosca commented 3 years ago

Yes I suppose that makes sense if the DraxList is building its own style. (I apologize, but I’ve been making these short replies from away from the computer without an opportunity to dig into the code.)

I’ve never seen a wrapped flex row list before and didn’t realize FlatList supports it. But thinking about it some more, it would definitely require DraxList to support x/y shift offsets rather than just a single dimension like it does now. So I think a PR like the one I linked above would be a prerequisite before we could make this work, and then an additional enhancement would be required to allow you to pass the proper style parameters. It seems to me it should be possible to pass your own styles and have them merge with and/or override whatever DraxList is using, at the user’s own risk. For now I will leave this issue open as an enhancement request.

I have recently started a new job and am unsure how soon I will be putting any significant dev sessions into Drax, but other contributors are also welcome.