-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix(android): Fix bridgeless mode support #3352
Conversation
// Fallback to use `BatchedBridge.registerCallableModule()` for older versions. | ||
// eslint-disable-next-line global-require | ||
= require('react-native').registerCallableModule | ||
?? BatchedBridge.registerCallableModule.bind(BatchedBridge); |
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.
@Kudo, in 0.73, we also have access to global.RN$registerCallableModule in bridgeless mode. If you also include that in the fallback, then we could make this library bridgeless mode compatible in 0.73.
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.
thanks @RSNara for taking a look and having the feedback. i'm lean toward to claim the bridgeless support for react-native-webview from 0.74, because i didn't run any bridgeless test on on 0.73.
## [13.8.2](v13.8.1...v13.8.2) (2024-03-21) ### Bug Fixes * **android:** Fix bridgeless mode support ([#3352](#3352)) ([8411ba0](8411ba0))
🎉 This PR is included in version 13.8.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
late response but much appreciated for the help from @Titozzz to get the fix published. |
I believe this may have introduced a regression. #3368 |
|
||
useEffect(() => { | ||
BatchedBridge.registerCallableModule(messagingModuleName, directEventCallbacks); | ||
registerCallableModule('RNCWebViewMessagingModule', directEventCallbacks); |
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.
Should this first parameter be static and not messagingModuleName
? Perhaps this is what may cause #3368
Why
react-native-webview does not work on react-native 0.74 with bridgeless mode
How
there were two errors actually:
shouldStartLoadWithLockIdentifier()
. the newer codegen supports Int32 and generates java code as int type. the current code is using double type. the pr tries to use double type as the implementation using double under the hood.CatalystInstance
. it seems react-native-webview used it for sending direct message. BridgelessReactContext does not have equivalentcallFunction(moduleName: string, ...)
. this pr tries to register a singleRNCWebViewMessagingModule
module and check the underlyingmessagingModuleName
inside the event. each webview will only receive events belong itsmessagingModuleName
.Test Plan