Closed musicode closed 2 months ago
you can try:
`
const [resetOnMessage, setResetOnMessage] = useState(false);
useEffect(() => { const unsubscribe = navigation.addListener('focus', () => { if (Platform.OS === 'android'){ setResetOnMessage(!resetOnMessage); } }); return unsubscribe; }, []);
const handleMessage = (event: WebViewMessageEvent) => {
};
<WebView
source={{ uri: initUrl}}
... ...
onMessage={resetOnMessage ? handleMessage : handleMessage}
... ...
/>
`
I face a similar problem, when I use Webview within Flatlist, only the last message is captured
Seems related to #3352 (/cc @Kudo 🫣)
i'm sorry to introduce the regression. does it require multiple WebView or enough for single WebView? would be highly appreciated if someone could help to create a repro
I have not fully tested this, I was looking into recent changes, but my understanding is that this is what happens:
onMessage
Looking at the changes in #3352 I'm not sure I understand the exact reason for switching the first parameter here to a constant: https://github.com/react-native-webview/react-native-webview/pull/3352#discussion_r1549718289
We use onShouldStartLoadWithRequest
to load most webpages in a new screen in a stack, rather than in the same view. We've noticed that since 13.8.2 this no longer works on Android. RN 0.73.6.
Would this issue be related to that?
Rolling back to 13.8.1 fixes it.
I can confirm the problem with onMessage
starting from 13.8.2 (several WebViews if it's important)
We use
onShouldStartLoadWithRequest
to load most webpages in a new screen in a stack, rather than in the same view. We've noticed that since 13.8.2 this no longer works on Android. RN 0.73.6. Would this issue be related to that? Rolling back to 13.8.1 fixes it.
Running into the same issue, when logging this block it looks like the messagingModuleName
equality check is failing on subsequent onShouldStartLoadWithRequest
/onMessage
invocations.
:tada: This issue has been resolved in version 13.8.5 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
First, I open a webview page, then I open a new webview page, when I close the new page, the bridge in the first page is not work.
v13.8.1
is ok, butv13.8.2
is not work.os: android