From d947860587ce2739682e9dcfa3b3ed524e648aa3 Mon Sep 17 00:00:00 2001 From: Waqar Amjad Date: Tue, 17 Jun 2025 14:33:24 +0300 Subject: [PATCH] feat: add shouldAllowNavigation prop to GameballWidget for WebView navigation control --- src/GameballWidget/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/GameballWidget/index.tsx b/src/GameballWidget/index.tsx index adaf7e7..c555b95 100644 --- a/src/GameballWidget/index.tsx +++ b/src/GameballWidget/index.tsx @@ -7,7 +7,11 @@ import { Platform, Share, } from 'react-native'; -import { WebView, type WebViewMessageEvent } from 'react-native-webview'; +import { + WebView, + type WebViewMessageEvent, + type WebViewNavigation, +} from 'react-native-webview'; import Modal from 'react-native-modal'; import styles from './styles'; const package_json = require('../../package.json'); @@ -16,6 +20,7 @@ interface Props { modal?: boolean; openDetail?: string; hideNavigation?: boolean; + shouldAllowNavigation?: (event: WebViewNavigation) => boolean; } interface State { @@ -146,6 +151,7 @@ class GameballWidget extends React.Component { originWhitelist={originWhitelist} showsVerticalScrollIndicator={false} onMessage={this.onMessage} + onShouldStartLoadWithRequest={this.props.shouldAllowNavigation} injectedJavaScriptBeforeContentLoaded=" if (navigator.share == null) { navigator.share = (param) => {