Skipperlla / rn-swiper-list

⚡ Lightning fast and customizable tinder-like swiper for React Native
https://www.npmjs.com/package/rn-swiper-list
MIT License
136 stars 14 forks source link

Question: v1.7 with Reanimated 3 #24

Closed PEZO19 closed 3 months ago

PEZO19 commented 3 months ago

Hi there @Skipperlla !

Just wondering if you've encountered the following problem while you were migrating to v2: from Reanimated 2.14 to Reanimated 3. My issue is that after updating to Reanimated 3, if I use your lib on 1.x there is a little bit of flickering / lagging (with 10-20% chance) when I start to drag a card. The whole card jumps from the current dragged position back to a couple of millisec before and then back to the recent/valid dragged position, then continous its journey properly...

This is 100% due to the reason I updated to Reanimated 3 (to get rid of useAnimatedStyle which caused memory leak), I made no other changes. I also tried to update react-native-gesture-handler and mimic your recent code from v2, but this flickering / lagging is still there.

Have you run into that issue? I am just wondering how can I solve that without restructuring my codebase to be able to use v2 if that's possible.

PEZO19 commented 3 months ago

Turns out the issue is that recent Reanimated versions are just laggy by default. When I rolled back to 3.6.3, the problem has gone. On latest version(s) work on the JS thread could lock up the animation causing flickering.

These seem to be relatated: https://github.com/software-mansion/react-native-reanimated/issues/6102 with https://github.com/software-mansion/react-native-reanimated/issues/6102#issuecomment-2163825540 https://github.com/software-mansion/react-native-reanimated/issues/5816

I have seen that @Skipperlla made amazing optimizations recently with rn-swiper-list on v2 much work on the UI thread / with sharedValues. I'd be curious if that was necessary because of the weird new laggyness or it was an independent improvement. Anyway, my problem is that even with these optimizations the JS part could cause problems. If so, revert back to older Reanimated 3 versions until they fix it.