hoangnm / react-native-week-view

Week View Component for react-native
MIT License
281 stars 98 forks source link

(hot)fix ANR: Add runOnJS prop #297

Closed pdpino closed 1 year ago

pdpino commented 1 year ago

Hot fixes #259

hoangnm commented 1 year ago

Hi @pdpino , could you explain why setting it run on js can solve the issue?

pdpino commented 1 year ago

@hoangnm it fixes the issue in RNGH, as I reported in this bug in their repo.

Setting gesture.runOnJS(true) makes the animations run in the JS context instead of the UI thread. In other words, the callback provided inside onEnd(() => {...}) is run in the JS context instead of the UI thread. Apparently, the bug only occurs when running certain code on the UI thread.

In theory, animations are smoother when run in the UI thread. But still they can be run in JS and works fine. (Read more details in rn-reanimated worklets docs)

hoangnm commented 1 year ago

thanks, it makes sense, let's merge this to see if it works for other users.

hoangnm commented 1 year ago

wait, I can create the alpha version first.

pdpino commented 1 year ago

@hoangnm do you have an ETA on merging this? This issue has been waiting for long :sweat_smile:

hoangnm commented 1 year ago

ok, merging.