nuclearpasta / react-native-drax

A drag-and-drop system for React Native
MIT License
545 stars 63 forks source link

Cant drag component on modal #69

Open hak11 opened 3 years ago

hak11 commented 3 years ago

how to make component dragable on modal.

drag components work perfectly in screen, but when I put a component in the modal, it makes it non-dragged

package.json

{
     ...,
    "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz",
    "expo": "~39.0.2",
    "react-native-drax": "^0.7.2",
   ....
}


import {
    View, Modal
} from 'react-native'

<Modal
 animationType="slide"
 transparent={false}
 visible={true}
>
<DraxProvider>
  <DraxScrollView>
      <DraxView ...... />
      <DraxView ...... />
      <DraxView ...... />
      <DraxView ...... />
  </DraxScrollView>
</DraxProvider>
</Modal>
lafiosca commented 3 years ago

Could you try wrapping the DraxProvider around the outside of the Modal instead of nesting under it?

hak11 commented 3 years ago

still can't @lafiosca , this is snack link if you want see or try it https://snack.expo.io/@joe-pasartrainer/drag-&-drop

lafiosca commented 3 years ago

Thank you, I’ll try to take a look when I’m able. I haven’t used the built-in Modal component in a long time, so I’m not sure how exactly it works or why it would interfere.

hak11 commented 3 years ago

thank you @lafiosca

ayratkin commented 9 months ago

same problem. react-native-drax doesnt work in native modal component((( @lafiosca

LunatiqueCoder commented 9 months ago

We'll take a look at it, but if you want to hurry up the process, a reproduction example would be great. You can start from here: https://snack.expo.dev/@lunatiquecoder/expo-drax-example

Add a <Modal />, reproduce the issue, and definitely you'll get the help you want faster!

EDIT: sorry, I just saw there is a reproduction provided. Taking a look at it sometime this week.

LunatiqueCoder commented 9 months ago

I just did a few simple checks on https://snack.expo.dev/@lunatiquecoder/expo-drax-example. If you put the<DraxProvider /> outside the modal, it seems to be displaying the dragged/released hover views BEHIND the modal children. This can be observed by using transparent={true} prop on the <Modal /> component:

🎥 VIDEO

https://github.com/nuclearpasta/react-native-drax/assets/55203625/a94ab335-95da-4e8f-b325-58acabf744b5
❌ Other NOT WORKING examples: image ![image](https://github.com/nuclearpasta/react-native-drax/assets/55203625/c62463e6-44af-407d-bc0f-e28d19a4df83)

However, if you nest everything under the <Modal />, it seems to work:

WORKING examples: image Screenshot 2023-12-05 at 23 53 44

I believe this can be fixed/improved in the next major version. Will be looking deeper into it as we advance and come back with more information or updates.