From 9126add6b95d4d3defb9bb4d2a934252d1772907 Mon Sep 17 00:00:00 2001 From: Vishwesh Jainkuniya Date: Sun, 17 Feb 2019 14:30:44 -0800 Subject: [PATCH] Add prop to configure `importantForAutofill`. (#22763) Summary: In API 26, autofill framework was introduced in Android. Read more about Autofill at https://developer.android.com/guide/topics/text/autofill. Now, if in case for some text input if developer wants to disable autofill then he can take help from this `importantForAutoFill` prop and pass `no` to it. Also important of auto fill can be configured with this prop, like: * `auto`: Let the Android System use its heuristics to determine if the view is important for autofill. * `no`: This view isn't important for autofill. * `noExcludeDescendants`: This view and its children aren't important for autofill. * `yes`: This view is important for autofill. * `yesExcludeDescendants`: This view is important for autofill, but its children aren't important for autofill. Default value if `auto`. Read more at: https://developer.android.com/guide/topics/text/autofill-optimize Changelog: ---------- [Android] [Added] - Add prop to configure `importantForAutofill` in `TextInput`. Pull Request resolved: https://github.com/facebook/react-native/pull/22763 Differential Revision: D14121242 Pulled By: cpojer fbshipit-source-id: aa4360480dd19f6dde66f0409d26a41a6a318c94 --- Libraries/Components/TextInput/TextInput.js | 7 +++++++ .../textinput/ReactTextInputManager.java | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index a5297cbe7..34af8db6d 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -245,6 +245,13 @@ type AndroidProps = $ReadOnly<{| underlineColorAndroid?: ?ColorValue, inlineImageLeft?: ?string, inlineImagePadding?: ?number, + importantForAutofill?: ?( + | 'auto' + | 'no' + | 'noExcludeDescendants' + | 'yes' + | 'yesExcludeDescendants' + ), |}>; type Props = $ReadOnly<{| diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index 74ac875be..9cb5990ed 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -10,6 +10,7 @@ package com.facebook.react.views.textinput; import android.graphics.PorterDuff; import android.graphics.Typeface; import android.graphics.drawable.Drawable; +import android.os.Build; import android.support.v4.content.ContextCompat; import android.text.Editable; import android.text.InputFilter; @@ -279,6 +280,24 @@ public class ReactTextInputManager extends BaseViewManager