Webview disable save form prop
Summary: Adds functionality to be able to disable saving of form data and thereby disabling autocomplete in webview on Android. Can be used as a workaround for #13241 Manual testing that autocomplete is disabled when the property is set to true, and still enabled when it is unset or set to false. Closes https://github.com/facebook/react-native/pull/13271 Differential Revision: D4858899 Pulled By: ericvicenti fbshipit-source-id: 62738b0685e4c1958c8a32e184fa2fe4f711b336
This commit is contained in:
parent
2336ac299c
commit
8591d8ae71
|
@ -184,11 +184,18 @@ class WebView extends React.Component {
|
|||
'always',
|
||||
'compatibility'
|
||||
]),
|
||||
|
||||
/**
|
||||
* Used on Android only, controls whether form autocomplete data should be saved
|
||||
* @platform android
|
||||
*/
|
||||
saveFormDataDisabled: PropTypes.bool,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
javaScriptEnabled : true,
|
||||
scalesPageToFit: true,
|
||||
saveFormDataDisabled: false
|
||||
};
|
||||
|
||||
state = {
|
||||
|
@ -261,6 +268,7 @@ class WebView extends React.Component {
|
|||
mediaPlaybackRequiresUserAction={this.props.mediaPlaybackRequiresUserAction}
|
||||
allowUniversalAccessFromFileURLs={this.props.allowUniversalAccessFromFileURLs}
|
||||
mixedContentMode={this.props.mixedContentMode}
|
||||
saveFormDataDisabled={this.props.saveFormDataDisabled}
|
||||
/>;
|
||||
|
||||
return (
|
||||
|
|
|
@ -397,6 +397,11 @@ public class ReactWebViewManager extends SimpleViewManager<WebView> {
|
|||
public void setAllowUniversalAccessFromFileURLs(WebView view, boolean allow) {
|
||||
view.getSettings().setAllowUniversalAccessFromFileURLs(allow);
|
||||
}
|
||||
|
||||
@ReactProp(name = "saveFormDataDisabled")
|
||||
public void setSaveFormDataDisabled(WebView view, boolean disable) {
|
||||
view.getSettings().setSaveFormData(!disable);
|
||||
}
|
||||
|
||||
@ReactProp(name = "injectedJavaScript")
|
||||
public void setInjectedJavaScript(WebView view, @Nullable String injectedJavaScript) {
|
||||
|
|
Loading…
Reference in New Issue