Breaking change - Disable WebView geolocation by default
Reviewed By: yungsters Differential Revision: D7846198 fbshipit-source-id: 8d6daff4b794d3569b5ddba2d8d62af8c7ff5b03
This commit is contained in:
parent
ba88292130
commit
23d61b35fb
|
@ -138,6 +138,12 @@ class WebView extends React.Component {
|
|||
*/
|
||||
domStorageEnabled: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* Sets whether Geolocation is enabled. The default is false.
|
||||
* @platform android
|
||||
*/
|
||||
geolocationEnabled: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* Sets the JS to be injected when the webpage loads.
|
||||
*/
|
||||
|
@ -310,6 +316,7 @@ class WebView extends React.Component {
|
|||
onLoadingFinish={this.onLoadingFinish}
|
||||
onLoadingError={this.onLoadingError}
|
||||
testID={this.props.testID}
|
||||
geolocationEnabled={this.props.geolocationEnabled}
|
||||
mediaPlaybackRequiresUserAction={this.props.mediaPlaybackRequiresUserAction}
|
||||
allowUniversalAccessFromFileURLs={this.props.allowUniversalAccessFromFileURLs}
|
||||
mixedContentMode={this.props.mixedContentMode}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue