react-native-webview / react-native-webview

React Native Cross-Platform WebView
https://github.com/react-native-community/discussions-and-proposals/pull/3
MIT License
6.32k stars 2.96k forks source link

fix(android): Fix bridgeless mode support #3352

Closed Kudo closed 3 months ago

Kudo commented 3 months ago

Why

react-native-webview does not work on react-native 0.74 with bridgeless mode

How

there were two errors actually:

  1. build error from override 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.
  2. on bridgeless mode, we cannot access CatalystInstance. it seems react-native-webview used it for sending direct message. BridgelessReactContext does not have equivalent callFunction(moduleName: string, ...). this pr tries to register a single RNCWebViewMessagingModule module and check the underlying messagingModuleName inside the event. each webview will only receive events belong its messagingModuleName.

Test Plan

react-native-community-bot commented 3 months ago

:tada: This PR is included in version 13.8.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Kudo commented 3 months ago

late response but much appreciated for the help from @Titozzz to get the fix published.

andreialecu commented 2 months ago

I believe this may have introduced a regression. #3368