Repository navigation
fix(react-native): codegen TurboModule instead of the interop layer - #115
Conversation
🦋 Changeset detectedLatest commit: 5403c3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
TimoGlastra
left a comment
There was a problem hiding this comment.
I don't really see a JS interface for all the methods, just the install? Doesn't codegen generate the interface for all methods, we still manually register them on the module on the c++ side right?
Once we drop support for the old arch, can we drop the Java and object c layers?
|
I think the CI failure is because of callstackincubator/react-native-harness#299 |
Only for what's in the spec, and the spec only has
Mostly. On Android we can drop them completely and ship a pure C++ TurboModule, which React Native and Expo autolink. On iOS, React Native still finds a library's modules through an Objective-C class, so a small provider stays. |
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
I've applied a patch to work around this. Will create a PR upstream to see if it is an appropriate solution. |
@openwallet-foundation/askar-react-nativenow ships a TurboModule generated with codegen, instead of a legacy module that React Native loads through its interop layer. It builds on #96, which made the bindings install in bridgeless mode on iOS.The spec in
src/specs/NativeAskar.tsdeclaresinstall(). On iOS, the module returns the generatedNativeAskarSpecJSIand still installs the bindings ininstallJSIBindingsWithRuntime:. On Android, it extends the generatedNativeAskarSpecand implementsTurboModuleWithJSIBindings, so React Native installs the bindings when it creates the module (available since React Native 0.76, so the>= 0.77peer range doesn't change). On the New Architecture, JS no longer has to callinstall().The old architecture keeps working through the bridge
install(). On Android, a copy of the generated spec insrc/oldarchstands in for codegen there.