Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(hot)fix ANR: Add runOnJS prop #297

Merged
merged 3 commits into from
Feb 25, 2023
Merged

Conversation

pdpino
Copy link
Collaborator

@pdpino pdpino commented Feb 8, 2023

Hot fixes #259

@pdpino pdpino changed the title Add runOnJS prop (hot)fix ANR: Add runOnJS prop Feb 8, 2023
@hoangnm
Copy link
Owner

hoangnm commented Feb 10, 2023

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

@pdpino
Copy link
Collaborator Author

pdpino commented Feb 10, 2023

@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
Copy link
Owner

hoangnm commented Feb 11, 2023

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

@hoangnm
Copy link
Owner

hoangnm commented Feb 11, 2023

wait, I can create the alpha version first.

@pdpino
Copy link
Collaborator Author

pdpino commented Feb 22, 2023

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

@hoangnm hoangnm merged commit 6d87fa0 into hoangnm:master Feb 25, 2023
@hoangnm
Copy link
Owner

hoangnm commented Feb 25, 2023

ok, merging.

@pdpino pdpino deleted the bug/259-runonjs branch March 23, 2023 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: GOOGLE PIXEL(Android 13) hang on scrolling horizontal.
2 participants