Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated TextInput autoCompleteType prop to autoComplete #26010

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export type NativeProps = $ReadOnly<{|
*
* @platform android
*/
autoCompleteType?: WithDefault<
autoComplete?: WithDefault<
| 'cc-csc'
| 'cc-exp'
| 'cc-exp-month'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const AndroidTextInputViewConfig = {
keyboardType: true,
multiline: true,
color: {process: require('../../StyleSheet/processColor')},
autoCompleteType: true,
autoComplete: true,
numberOfLines: true,
letterSpacing: true,
returnKeyLabel: true,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ type AndroidProps = $ReadOnly<{|
*
* @platform android
*/
autoCompleteType?: ?(
autoComplete?: ?(
| 'cc-csc'
| 'cc-exp'
| 'cc-exp-month'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = {
*
* @platform android
*/
autoCompleteType: (PropTypes.oneOf([
autoComplete: (PropTypes.oneOf([
'cc-csc',
'cc-exp',
'cc-exp-month',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,39 +655,39 @@ public void setMaxLength(ReactEditText view, @Nullable Integer maxLength) {
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 ("username".equals(autoCompleteType)) {
} else if ("username".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_USERNAME);
} else if ("password".equals(autoCompleteType)) {
} else if ("password".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_PASSWORD);
} else if ("email".equals(autoCompleteType)) {
} else if ("email".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_EMAIL_ADDRESS);
} else if ("name".equals(autoCompleteType)) {
} else if ("name".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_NAME);
} else if ("tel".equals(autoCompleteType)) {
} else if ("tel".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_PHONE);
} else if ("street-address".equals(autoCompleteType)) {
} else if ("street-address".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_POSTAL_ADDRESS);
} else if ("postal-code".equals(autoCompleteType)) {
} else if ("postal-code".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_POSTAL_CODE);
} else if ("cc-number".equals(autoCompleteType)) {
} else if ("cc-number".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_CREDIT_CARD_NUMBER);
} else if ("cc-csc".equals(autoCompleteType)) {
} else if ("cc-csc".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE);
} else if ("cc-exp".equals(autoCompleteType)) {
} else if ("cc-exp".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE);
} else if ("cc-exp-month".equals(autoCompleteType)) {
} else if ("cc-exp-month".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH);
} else if ("cc-exp-year".equals(autoCompleteType)) {
} else if ("cc-exp-year".equals(autoComplete)) {
setAutofillHints(view, View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR);
} else if ("off".equals(autoCompleteType)) {
} else if ("off".equals(autoComplete)) {
setImportantForAutofill(view, View.IMPORTANT_FOR_AUTOFILL_NO);
} else {
throw new JSApplicationIllegalArgumentException(
"Invalid autoCompleteType: " + autoCompleteType);
"Invalid autoComplete: " + autoComplete);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ AndroidTextInputProps::AndroidTextInputProps(
const RawProps &rawProps)
: ViewProps(sourceProps, rawProps),
BaseTextProps(sourceProps, rawProps),
autoCompleteType(convertRawProp(
autoComplete(convertRawProp(
rawProps,
"autoCompleteType",
sourceProps.autoCompleteType,
"autoComplete",
sourceProps.autoComplete,
{})),
returnKeyLabel(convertRawProp(
rawProps,
Expand Down Expand Up @@ -294,7 +294,7 @@ AndroidTextInputProps::AndroidTextInputProps(
// TODO T53300085: support this in codegen; this was hand-written
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class AndroidTextInputProps final : public ViewProps, public BaseTextProps {

#pragma mark - Props

const std::string autoCompleteType{};
const std::string autoComplete{};
const std::string returnKeyLabel{};
const int numberOfLines{0};
const bool disableFullscreenUI{false};
Expand Down