Skip to content

Commit daa6b0a

Browse files
drtangiblefacebook-github-bot
authored andcommitted
Update types for autoComplete prop. (#25549)
Summary: I believe there's a mismatch between the type definitions and the expected prop in Android for `TextInput`'s `autoComplete` prop. * Android is expecting `autoComplete`. * JS types are expecting `autoCompleteType`. * Latest documentation documents `autoCompleteType`. Prop added here: 179d490 This change updates the JS types to match what Android is expecting (`autoComplete`). Can update documentation if this is the approach we'd prefer (rather than updating Android to expect `autoCompleteType`). ## Changelog [Javascript] [Fixed] - Update types for `TextInput`'s `autoComplete` prop. Pull Request resolved: #25549 Test Plan: Before: * Pass invalid value to `TextInput`'s `autoComplete` prop, see no type errors on JS side, and Android blows up with: ```sh Invalid autocomplete option: foobar updateViewProp ViewManagersPropertyCache.java:95 setProperty ViewManagerPropertyUpdater.java:132 updateProps ViewManagerPropertyUpdater.java:51 updateProperties ViewManager.java:37 ``` After: * Pass invalid value to `TextInput`'s `autoComplete` prop, see PropType warning for `autoComplete` prop. Differential Revision: D16220809 Pulled By: mdvacca fbshipit-source-id: e25e198cbcbe721c8d71f069bba293856bf5f36d
1 parent afe06e5 commit daa6b0a

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -589,39 +589,39 @@ public void setMaxLength(ReactEditText view, @Nullable Integer maxLength) {
589589
view.setFilters(newFilters);
590590
}
591591

592-
@ReactProp(name = "autoComplete")
593-
public void setTextContentType(ReactEditText view, @Nullable String autocomplete) {
594-
if (autocomplete == null) {
592+
@ReactProp(name = "autoCompleteType")
593+
public void setTextContentType(ReactEditText view, @Nullable String autoCompleteType) {
594+
if (autoCompleteType == null) {
595595
setImportantForAutofill(view, View.IMPORTANT_FOR_AUTOFILL_NO);
596-
} else if ("username".equals(autocomplete)) {
596+
} else if ("username".equals(autoCompleteType)) {
597597
setAutofillHints(view, View.AUTOFILL_HINT_USERNAME);
598-
} else if ("password".equals(autocomplete)) {
598+
} else if ("password".equals(autoCompleteType)) {
599599
setAutofillHints(view, View.AUTOFILL_HINT_PASSWORD);
600-
} else if ("email".equals(autocomplete)) {
600+
} else if ("email".equals(autoCompleteType)) {
601601
setAutofillHints(view, View.AUTOFILL_HINT_EMAIL_ADDRESS);
602-
} else if ("name".equals(autocomplete)) {
602+
} else if ("name".equals(autoCompleteType)) {
603603
setAutofillHints(view, View.AUTOFILL_HINT_NAME);
604-
} else if ("tel".equals(autocomplete)) {
604+
} else if ("tel".equals(autoCompleteType)) {
605605
setAutofillHints(view, View.AUTOFILL_HINT_PHONE);
606-
} else if ("street-address".equals(autocomplete)) {
606+
} else if ("street-address".equals(autoCompleteType)) {
607607
setAutofillHints(view, View.AUTOFILL_HINT_POSTAL_ADDRESS);
608-
} else if ("postal-code".equals(autocomplete)) {
608+
} else if ("postal-code".equals(autoCompleteType)) {
609609
setAutofillHints(view, View.AUTOFILL_HINT_POSTAL_CODE);
610-
} else if ("cc-number".equals(autocomplete)) {
610+
} else if ("cc-number".equals(autoCompleteType)) {
611611
setAutofillHints(view, View.AUTOFILL_HINT_CREDIT_CARD_NUMBER);
612-
} else if ("cc-csc".equals(autocomplete)) {
612+
} else if ("cc-csc".equals(autoCompleteType)) {
613613
setAutofillHints(view, View.AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE);
614-
} else if ("cc-exp".equals(autocomplete)) {
614+
} else if ("cc-exp".equals(autoCompleteType)) {
615615
setAutofillHints(view, View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE);
616-
} else if ("cc-exp-month".equals(autocomplete)) {
616+
} else if ("cc-exp-month".equals(autoCompleteType)) {
617617
setAutofillHints(view, View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH);
618-
} else if ("cc-exp-year".equals(autocomplete)) {
618+
} else if ("cc-exp-year".equals(autoCompleteType)) {
619619
setAutofillHints(view, View.AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR);
620-
} else if ("off".equals(autocomplete)) {
620+
} else if ("off".equals(autoCompleteType)) {
621621
setImportantForAutofill(view, View.IMPORTANT_FOR_AUTOFILL_NO);
622622
} else {
623623
throw new JSApplicationIllegalArgumentException(
624-
"Invalid autocomplete option: " + autocomplete);
624+
"Invalid autoCompleteType: " + autoCompleteType);
625625
}
626626
}
627627

0 commit comments

Comments
 (0)