mirror of
https://github.com/status-im/react-native.git
synced 2025-02-06 06:34:01 +00:00
Android WebView “tel:” links show web page not found - issue fixed
Summary: Submitting PR #6810 - Android WebView “tel:” links show web page not found - issue fixed. 'tel:' link web page not loading: ![screenshot_2016-07-01-19-48-05](https://cloud.githubusercontent.com/assets/11989113/16525364/b3e9f10c-3fc9-11e6-8119-93cdf24d54df.png) After Fixing the issue: ![screenshot_2016-07-01-19-52-00](https://cloud.githubusercontent.com/assets/11989113/16525371/c0d74d92-3fc9-11e6-899b-570a940692f6.png) Closes https://github.com/facebook/react-native/pull/8526 Differential Revision: D3554500 fbshipit-source-id: e8cc1ac4c36ddf0c6b261a29b2e038caddc03e75
This commit is contained in:
parent
b06b7ae609
commit
33a1f28654
@ -41,6 +41,8 @@ import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.annotations.ReactProp;
|
||||
import com.facebook.react.uimanager.events.Event;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
/**
|
||||
* Manages instances of {@link WebView}
|
||||
@ -111,6 +113,18 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
||||
createWebViewEvent(webView, url)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (url.startsWith("http://") || url.startsWith("https://")) {
|
||||
return false;
|
||||
} else {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
view.getContext().startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedError(
|
||||
WebView webView,
|
||||
|
Loading…
x
Reference in New Issue
Block a user