From a70aeba14025e76479f65cbd7b7412d4082fd517 Mon Sep 17 00:00:00 2001 From: Kuba Adamczyk Date: Mon, 9 Feb 2026 12:18:35 +0100 Subject: [PATCH 1/2] prevent showing default dialogs for beforeunload --- .../reactnativecommunity/webview/RNCWebChromeClient.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java b/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java index 7c0131811..6dab254a9 100644 --- a/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java +++ b/android/src/main/java/com/reactnativecommunity/webview/RNCWebChromeClient.java @@ -511,4 +511,10 @@ public boolean onJsPrompt(WebView view, String url, String message, String defau } return false; } + + @Override + public boolean onJsBeforeUnload(WebView view, String url, String message, JsResult result) { + result.confirm(); + return true; // Consumed - don't show default dialog + } } From c71924ca86ba4490f87f528115270bbdf05f1b9a Mon Sep 17 00:00:00 2001 From: Kuba Adamczyk Date: Mon, 9 Feb 2026 12:29:07 +0100 Subject: [PATCH 2/2] changeset --- .changeset/happy-snails-sleep.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/happy-snails-sleep.md diff --git a/.changeset/happy-snails-sleep.md b/.changeset/happy-snails-sleep.md new file mode 100644 index 000000000..0ce471395 --- /dev/null +++ b/.changeset/happy-snails-sleep.md @@ -0,0 +1,5 @@ +--- +'@phantom/react-native-webview': patch +--- + +Prevent showing beforeunload event alerts and always allow proceeding