mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-03 22:48:25 +08:00
Breaking change - Disable WebView geolocation by default
Reviewed By: yungsters Differential Revision: D7846198 fbshipit-source-id: 8d6daff4b794d3569b5ddba2d8d62af8c7ff5b03
This commit is contained in:
committed by
Facebook Github Bot
parent
ba88292130
commit
23d61b35fb
@@ -384,6 +384,7 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
||||
new LayoutParams(LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.MATCH_PARENT));
|
||||
|
||||
setGeolocationEnabled(webView, false);
|
||||
if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
WebView.setWebContentsDebuggingEnabled(true);
|
||||
}
|
||||
@@ -538,6 +539,13 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = "geolocationEnabled")
|
||||
public void setGeolocationEnabled(
|
||||
WebView view,
|
||||
@Nullable Boolean isGeolocationEnabled) {
|
||||
view.getSettings().setGeolocationEnabled(isGeolocationEnabled != null && isGeolocationEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addEventEmitters(ThemedReactContext reactContext, WebView view) {
|
||||
// Do not register default touch emitter and let WebView implementation handle touches
|
||||
|
||||
Reference in New Issue
Block a user