Using CallbackWrapper in async operations #3277
stephenkopylov
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
First of all - thank you for your amazing libraries, guys!
I analysed your cxx code for a little and found that you're not using Facebook's
CallbackWrapper
at allIt would be really useful for example here (NativeReanimatedModule.cpp)
If JS runtime was recreated (for example because of CodePush update, or hot reloading while debugging) we cannot be sure that
funPtr
is still alive insidescheduleOnUI
andscheduleOnJS
blocksIn our own TurboModules we use
CallbackWrapper
from<ReactCommon/TurboModuleUtils.h>
and it works perfect - if runtime was destroyed all callbacks are destroyed too.So, using CallbackWrapper your code will be more like this:
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions