nuclearpasta / react-native-drax

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

DraxView all rendering issues #169

Open LeoLeoLeoLei opened 10 months ago

LeoLeoLeoLei commented 10 months ago

Hi, I'm encountering an issue here. In the layout of my app, when I long-press on element A, it transforms into a draggable item that can be moved to the left. If A is positioned over 1, it can be dropped. However, I've noticed that when there are 119 cards on the left side, as seen in the profile image, during the process of moving A to 1, all DraxView components are re-rendered, causing performance issues on Android devices with lower specifications. Do you have any solutions? I've tried using DraxList, but the issue persists.

Is there a way for me to avoid rendering all DraxView components? For example, can I render only the DraxView components within the visible area?

Can you help me with this? Thank you very much.

Pasted Graphic image image

LunatiqueCoder commented 10 months ago

Hello @LeoLeoLeoLei. I believe it is because of the state in the React.Context Provider. Changing any state there will rerender the whole <Provider />.

We're currently experimenting with react-native-reanimated's useAnimatedReaction instead of React.Context, and it goes pretty well so far, unfortunately we still don't have a deadline when it will be ready...

LeoLeoLeoLei commented 10 months ago

Appreciate it. thank you