react-native-blockable-webview
react-native-blockable-webview copied to clipboard
Does not work on iOS
Hey, it seems to not work on iOS.
_handleAndroidNavigationChange({ nativeEvent }): Boolean {
const { url } = nativeEvent;
if (this.props.onLinking && typeof this.props.onLinking === 'function') {
this.props.onLinking(url);
}
Linking.openURL(url);
return;
}
...
render(): ReactElement<*> {
const {
html,
style,
...props,
} = this.props;
return (
<BlockableWebView
{...props}
style={[style, {height: this.state.height}]}
injectedJavaScript="document.body.scrollHeight;"
scrollEnabled={false}
javaScriptEnabled={true}
bounces={false}
source={{ html }}
onContentSizeChange={this._onHeightChange}
onNavigationStateChange={this._onNavigationStateChange}
navigationBlockingPolicies={[{ url: '.*' }]}
onNavigationBlocked={this._handleAndroidNavigationChange}/>
);
I try to catch each request to open them with Linking but none request pass by onNavigationBlocked where it works well on Android ! It seems to correctly clock the navigation event (it block the navigation event) but handleAndroidNavigationChange is never called :/
Any clue ?
ps: I saw your PR on React Native repository, great idea, loving it 👍
yes for me too , it didn't work for ios