mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
committed by
Facebook GitHub Bot
parent
feae814153
commit
8066bc9ff6
@@ -83,6 +83,7 @@ const AndroidTextInputViewConfig = {
|
||||
multiline: true,
|
||||
color: {process: require('../../StyleSheet/processColor')},
|
||||
autoCompleteType: true,
|
||||
autoComplete: true,
|
||||
numberOfLines: true,
|
||||
letterSpacing: true,
|
||||
returnKeyLabel: true,
|
||||
|
||||
+13
-8
@@ -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
|
||||
|
||||
+7
@@ -42,6 +42,12 @@ AndroidTextInputProps::AndroidTextInputProps(
|
||||
const RawProps &rawProps)
|
||||
: ViewProps(context, sourceProps, rawProps),
|
||||
BaseTextProps(context, sourceProps, rawProps),
|
||||
autoComplete(convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
"autoComplete",
|
||||
sourceProps.autoComplete,
|
||||
{})),
|
||||
autoCompleteType(convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
@@ -262,6 +268,7 @@ AndroidTextInputProps::AndroidTextInputProps(
|
||||
folly::dynamic AndroidTextInputProps::getDynamic() const {
|
||||
folly::dynamic props = folly::dynamic::object();
|
||||
props["autoCompleteType"] = autoCompleteType;
|
||||
props["autoComplete"] = autoComplete;
|
||||
props["returnKeyLabel"] = returnKeyLabel;
|
||||
props["numberOfLines"] = numberOfLines;
|
||||
props["disableFullscreenUI"] = disableFullscreenUI;
|
||||
|
||||
+1
@@ -107,6 +107,7 @@ class AndroidTextInputProps final : public ViewProps, public BaseTextProps {
|
||||
|
||||
#pragma mark - Props
|
||||
|
||||
const std::string autoComplete{};
|
||||
const std::string autoCompleteType{};
|
||||
const std::string returnKeyLabel{};
|
||||
const int numberOfLines{0};
|
||||
|
||||
Reference in New Issue
Block a user