Reputation: 1634
we are using
"react-native": "0.55.3",
"react-native-wkwebview-reborn": "^1.18.0",
we will load the WKWebView Component like this
<WKWebView
onLoad={ this.handleWebviewLoad }
source={ { uri: payment.redirect_url } }
style={ styles.webview }
/>
when payment is successful we get an redirect_target url like:
nativeapp://domain/buypayment/success
WKWebView now fails because of unsupported URL.
how can i tell WKWebView to support nativeapp://
also instead of just http://
and https://
?
Thanks!
Upvotes: 0
Views: 824
Reputation: 22189
Currently, there is no support for the other protocols in the package
react-native-wkwebview-reborn
In their RCTWKWebView.m
, it is explicitly set as
if ((navigationAction.targetFrame.isMainFrame || _openNewWindowInWebView) && ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"])) {
[webView loadRequest:navigationAction.request];
} else {
UIApplication *app = [UIApplication sharedApplication];
NSURL *url = navigationAction.request.URL;
if ([app canOpenURL:url]) {
[app openURL:url];
}
}
Meaning if the scheme is http
and https
, then it would load the request, else if it can open the url
, it'll create a shared instance of the application and open it if it is valid.
I don't know much of swift but this issue can be solved by adding a WKURLSchemeHandler
Checkout this article, which explains how to register and handle it.
Upvotes: 2