From 2ed418837bb82c3a50691044eebe318d721e50d9 Mon Sep 17 00:00:00 2001 From: Faraz Sherwani Date: Fri, 31 Mar 2017 10:45:30 -0400 Subject: [PATCH] Add saveFormDataDisabled prop to disable autocomplete --- Libraries/Components/WebView/WebView.android.js | 8 ++++++++ .../facebook/react/views/webview/ReactWebViewManager.java | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/Libraries/Components/WebView/WebView.android.js b/Libraries/Components/WebView/WebView.android.js index 294095035d36a0..f946a01fecc281 100644 --- a/Libraries/Components/WebView/WebView.android.js +++ b/Libraries/Components/WebView/WebView.android.js @@ -160,11 +160,18 @@ class WebView extends React.Component { * @platform android */ allowUniversalAccessFromFileURLs: PropTypes.bool, + + /** + * 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 = { @@ -236,6 +243,7 @@ class WebView extends React.Component { testID={this.props.testID} mediaPlaybackRequiresUserAction={this.props.mediaPlaybackRequiresUserAction} allowUniversalAccessFromFileURLs={this.props.allowUniversalAccessFromFileURLs} + saveFormDataDisabled={this.props.saveFormDataDisabled} />; return ( diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java index bc18f86b01d678..0e41fe342300b0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java @@ -396,6 +396,11 @@ public void setMediaPlaybackRequiresUserAction(WebView view, boolean requires) { 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) {