react-native-swipe-list-view icon indicating copy to clipboard operation
react-native-swipe-list-view copied to clipboard

onSwipeValueChange - throttle?

Open simplenotezy opened this issue 4 years ago • 2 comments

I noticed that onSwipeValueChange fires A LOT when a callback is provided.

Is it possible to throttle it?

On a simple swipe from one end of the screen to the other (on iPhone 11), the callback is fired 112 times.

simplenotezy avatar Aug 24 '21 19:08 simplenotezy

@simplenotezy There is a listener on the animated value that is used to swipe the row which is added via this method https://reactnative.dev/docs/animatedvalue#addlistener

There is no built in way to throttle the listener. I could add throttling to how often the onSwipeValueChange prop function is called, but it seems like unnecessary work as I've never seen performance degradation, have you?

jemise111 avatar Sep 06 '21 19:09 jemise111

hey i noticed performance degradation in this case. I create swipe to delete and standalone swipe from right and standalone swipe from left and it's working so slow. @simplenotezy is right it's too much re-renders when onSwipeValueChange is trigger. @jemise111

wiru123321 avatar Dec 13 '21 10:12 wiru123321