-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[ios][expotools] Fixes for versioned TurboModules #9862
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I misunderstand a bit what you wanted to do, change I suggested will still require a modifications in react-native but at least the lifecycle of object will be preserved.
In this PR I see pointer converted to void*, but I don't see anywhere that would restore it, am I missing sth?
I updated my suggestion after looking into react-native changes |
4253e79
to
3e837ad
Compare
3e837ad
to
acb85e4
Compare
# Why After versioning, TurboModules integration started to make more harm than good. # How - moved creating of the `JSCExecutorFactory`, which should be versioned, to versioned realm (otherwise we try to pass an unversioned code into a versioned bridge) (huge thanks to C++ senpai @wkozyra95 for assistance) - to achieve this I unfortunately had to modify `react-native` to 1. expect `void *` from `jsExecutorFactoryForBridge:`, otherwise we can't pass versioned factory through unversioned and back into versioned 2. do not detect whether delegate is an instance of `RCTCxxBridgeDelegate` by protocol, but by the actual method used. This is because delegate for all bridges is always `EXReactAppManager` which is not versioned. - another change is that `EXVersionManager` now **holds strongly** one instance of the `JSCExecutorFactory` instead of just creating it on every call. I think this shouldn't break anything, as on each bridge reload we create a new instance of `EXVersionManager` and there shouldn't be more calls to `jsExecutorFactoryForBridge:` apart from when setting the bridge up, but I think it's a note-worthy mention here. - then I bumped into the `XX is not a registered callable module` error which led me to update `expotools`'s pattern for adding `EX_REMOVE_VERSION` to `MessageQueue`. # Test Plan I have verified that these fixes work on a separate branch.
Why
After versioning, TurboModules integration started to make more harm than good.
How
JSCExecutorFactory
, which should be versioned, to versioned realm (otherwise we try to pass an unversioned code into a versioned bridge) (huge thanks to C++ senpai @wkozyra95 for assistance)react-native
tovoid *
fromjsExecutorFactoryForBridge:
, otherwise we can't pass versioned factory through unversioned and back into versionedRCTCxxBridgeDelegate
by protocol, but by the actual method used. This is because delegate for all bridges is alwaysEXReactAppManager
which is not versioned.EXVersionManager
now holds strongly one instance of theJSCExecutorFactory
instead of just creating it on every call. I think this shouldn't break anything, as on each bridge reload we create a new instance ofEXVersionManager
and there shouldn't be more calls tojsExecutorFactoryForBridge:
apart from when setting the bridge up, but I think it's a note-worthy mention here.XX is not a registered callable module
error which led me to updateexpotools
's pattern for addingEX_REMOVE_VERSION
toMessageQueue
.Test Plan
I have verified that these fixes work on a separate branch.