Updated TextInput autoCompleteType prop to autoComplete 1/2 (#26010)

Summary:
Fix for bug https://github.com/facebook/react-native/issues/26003 Rename TextInput prop "autoCompleteType" to "autoComplete".

## Changelog

[Android] [Changed] - Updated `autoCompleteType` prop of `TextInput` to `autoComplete`

Pull Request resolved: https://github.com/facebook/react-native/pull/26010

Test Plan:
Test Pass

PR for [Doc Update](https://github.com/facebook/react-native-website/pull/1184)

Reviewed By: mdvacca

Differential Revision: D29980220

Pulled By: lunaleaps

fbshipit-source-id: 3c9e7d3250b5f95b0dbd523fdb0d917a039cd6a9
This commit is contained in:
jeswinsimon
2021-07-30 03:16:35 -07:00
committed by Facebook GitHub Bot
parent feae814153
commit 8066bc9ff6
4 changed files with 22 additions and 8 deletions
@@ -715,20 +715,25 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
view.setFilters(newFilters);
}
@ReactProp(name = "autoCompleteType")
public void setTextContentType(ReactEditText view, @Nullable String autoCompleteType) {
if (autoCompleteType == null) {
@ReactProp(name = "autoComplete")
public void setTextContentType(ReactEditText view, @Nullable String autoComplete) {
if (autoComplete == null) {
setImportantForAutofill(view, View.IMPORTANT_FOR_AUTOFILL_NO);
} else if ("off".equals(autoCompleteType)) {
} else if ("off".equals(autoComplete)) {
setImportantForAutofill(view, View.IMPORTANT_FOR_AUTOFILL_NO);
} else if (REACT_PROPS_AUTOFILL_HINTS_MAP.containsKey(autoCompleteType)) {
setAutofillHints(view, REACT_PROPS_AUTOFILL_HINTS_MAP.get(autoCompleteType));
} else if (REACT_PROPS_AUTOFILL_HINTS_MAP.containsKey(autoComplete)) {
setAutofillHints(view, REACT_PROPS_AUTOFILL_HINTS_MAP.get(autoComplete));
} else {
throw new JSApplicationIllegalArgumentException(
"Invalid autoCompleteType: " + autoCompleteType);
throw new JSApplicationIllegalArgumentException("Invalid autoComplete: " + autoComplete);
}
}
// TODO: T96744578 - Delete autoCompleteType prop
@ReactProp(name = "autoCompleteType")
public void setTextContentTypeDeprecated(ReactEditText view, @Nullable String autoCompleteType) {
setTextContentType(view, autoCompleteType);
}
@ReactProp(name = "autoCorrect")
public void setAutoCorrect(ReactEditText view, @Nullable Boolean autoCorrect) {
// clear auto correct flags, set SUGGESTIONS or NO_SUGGESTIONS depending on value