Skip to content

Commit 9eb0881

Browse files
Marcel Lasajfacebook-github-bot
Marcel Lasaj
authored andcommitted
fix(android): Updated TextInput prop types to accomodate for new autoComplete values (#32575)
Summary: <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? --> This fixes the "Failed prop type: Invalid prop `autoComplete` of value `[any-of-the-new-values]`" warning, as mentioned in #32557. [This commit](d9e0ea7) introduced new HintConstants for autofill, but added those only to [`TextInput.js`](https://github.com/facebook/react-native/blob/main/Libraries/Components/TextInput/TextInput.js#L331) and forgot to add them (and the new docs' description) to either [`AndroidTextInputNativeComponent`](https://github.com/facebook/react-native/blob/main/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js#L99) or [`DeprecatedTextInputPropTypes.js`](https://github.com/facebook/react-native/blob/main/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js#L67). I know, the latter has clearly been deprecated, but until it is actually being removed, it shouldn't throw warnings like that. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Updated TextInput prop types to accomodate for new autoComplete values Pull Request resolved: #32575 Test Plan: There is no warning after these changes. Reviewed By: yungsters Differential Revision: D32324108 Pulled By: lunaleaps fbshipit-source-id: df27cbbd54788f26471029c9201c6a27ca8b7893
1 parent 614e602 commit 9eb0881

File tree

3 files changed

+177
-33
lines changed

3 files changed

+177
-33
lines changed

Libraries/Components/TextInput/AndroidTextInputNativeComponent.js

+59-11
Original file line numberDiff line numberDiff line change
@@ -73,42 +73,90 @@ export type NativeProps = $ReadOnly<{|
7373
* Android props after this
7474
*/
7575
/**
76-
* Determines which content to suggest on auto complete, e.g.`username`.
77-
* To disable auto complete, use `off`.
76+
* Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
77+
* To disable autocomplete, set `autoComplete` to `off`.
7878
*
7979
* *Android Only*
8080
*
81-
* The following values work on Android only:
81+
* Possible values for `autoComplete` are:
8282
*
83-
* - `username`
84-
* - `password`
85-
* - `email`
86-
* - `name`
87-
* - `tel`
88-
* - `street-address`
89-
* - `postal-code`
90-
* - `cc-number`
83+
* - `birthdate-day`
84+
* - `birthdate-full`
85+
* - `birthdate-month`
86+
* - `birthdate-year`
9187
* - `cc-csc`
9288
* - `cc-exp`
89+
* - `cc-exp-day`
9390
* - `cc-exp-month`
9491
* - `cc-exp-year`
92+
* - `cc-number`
93+
* - `email`
94+
* - `gender`
95+
* - `name`
96+
* - `name-family`
97+
* - `name-given`
98+
* - `name-middle`
99+
* - `name-middle-initial`
100+
* - `name-prefix`
101+
* - `name-suffix`
102+
* - `password`
103+
* - `password-new`
104+
* - `postal-address`
105+
* - `postal-address-country`
106+
* - `postal-address-extended`
107+
* - `postal-address-extended-postal-code`
108+
* - `postal-address-locality`
109+
* - `postal-address-region`
110+
* - `postal-code`
111+
* - `street-address`
112+
* - `sms-otp`
113+
* - `tel`
114+
* - `tel-country-code`
115+
* - `tel-national`
116+
* - `tel-device`
117+
* - `username`
118+
* - `username-new`
95119
* - `off`
96120
*
97121
* @platform android
98122
*/
99123
autoComplete?: WithDefault<
124+
| 'birthdate-day'
125+
| 'birthdate-full'
126+
| 'birthdate-month'
127+
| 'birthdate-year'
100128
| 'cc-csc'
101129
| 'cc-exp'
130+
| 'cc-exp-day'
102131
| 'cc-exp-month'
103132
| 'cc-exp-year'
104133
| 'cc-number'
105134
| 'email'
135+
| 'gender'
106136
| 'name'
137+
| 'name-family'
138+
| 'name-given'
139+
| 'name-middle'
140+
| 'name-middle-initial'
141+
| 'name-prefix'
142+
| 'name-suffix'
107143
| 'password'
144+
| 'password-new'
145+
| 'postal-address'
146+
| 'postal-address-country'
147+
| 'postal-address-extended'
148+
| 'postal-address-extended-postal-code'
149+
| 'postal-address-locality'
150+
| 'postal-address-region'
108151
| 'postal-code'
109152
| 'street-address'
153+
| 'sms-otp'
110154
| 'tel'
155+
| 'tel-country-code'
156+
| 'tel-national'
157+
| 'tel-device'
111158
| 'username'
159+
| 'username-new'
112160
| 'off',
113161
'off',
114162
>,

Libraries/Components/TextInput/TextInput.js

+35-11
Original file line numberDiff line numberDiff line change
@@ -305,25 +305,49 @@ type IOSProps = $ReadOnly<{|
305305

306306
type AndroidProps = $ReadOnly<{|
307307
/**
308-
* Determines which content to suggest on auto complete, e.g.`username`.
309-
* To disable auto complete, use `off`.
308+
* Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
309+
* To disable autocomplete, set `autoComplete` to `off`.
310310
*
311311
* *Android Only*
312312
*
313-
* The following values work on Android only:
313+
* Possible values for `autoComplete` are:
314314
*
315-
* - `username`
316-
* - `password`
317-
* - `email`
318-
* - `name`
319-
* - `tel`
320-
* - `street-address`
321-
* - `postal-code`
322-
* - `cc-number`
315+
* - `birthdate-day`
316+
* - `birthdate-full`
317+
* - `birthdate-month`
318+
* - `birthdate-year`
323319
* - `cc-csc`
324320
* - `cc-exp`
321+
* - `cc-exp-day`
325322
* - `cc-exp-month`
326323
* - `cc-exp-year`
324+
* - `cc-number`
325+
* - `email`
326+
* - `gender`
327+
* - `name`
328+
* - `name-family`
329+
* - `name-given`
330+
* - `name-middle`
331+
* - `name-middle-initial`
332+
* - `name-prefix`
333+
* - `name-suffix`
334+
* - `password`
335+
* - `password-new`
336+
* - `postal-address`
337+
* - `postal-address-country`
338+
* - `postal-address-extended`
339+
* - `postal-address-extended-postal-code`
340+
* - `postal-address-locality`
341+
* - `postal-address-region`
342+
* - `postal-code`
343+
* - `street-address`
344+
* - `sms-otp`
345+
* - `tel`
346+
* - `tel-country-code`
347+
* - `tel-national`
348+
* - `tel-device`
349+
* - `username`
350+
* - `username-new`
327351
* - `off`
328352
*
329353
* @platform android

Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js

+83-11
Original file line numberDiff line numberDiff line change
@@ -41,56 +41,128 @@ module.exports = {
4141
'characters',
4242
]): React$PropType$Primitive<'none' | 'sentences' | 'words' | 'characters'>),
4343
/**
44-
* Determines which content to suggest on auto complete, e.g.`username`.
45-
* To disable auto complete, use `off`.
44+
* Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
45+
* To disable autocomplete, set `autoComplete` to `off`.
4646
*
4747
* *Android Only*
4848
*
49-
* The following values work on Android only:
49+
* Possible values for `autoComplete` are:
5050
*
51-
* - `username`
52-
* - `password`
53-
* - `email`
54-
* - `name`
55-
* - `tel`
56-
* - `street-address`
57-
* - `postal-code`
58-
* - `cc-number`
51+
* - `birthdate-day`
52+
* - `birthdate-full`
53+
* - `birthdate-month`
54+
* - `birthdate-year`
5955
* - `cc-csc`
6056
* - `cc-exp`
57+
* - `cc-exp-day`
6158
* - `cc-exp-month`
6259
* - `cc-exp-year`
60+
* - `cc-number`
61+
* - `email`
62+
* - `gender`
63+
* - `name`
64+
* - `name-family`
65+
* - `name-given`
66+
* - `name-middle`
67+
* - `name-middle-initial`
68+
* - `name-prefix`
69+
* - `name-suffix`
70+
* - `password`
71+
* - `password-new`
72+
* - `postal-address`
73+
* - `postal-address-country`
74+
* - `postal-address-extended`
75+
* - `postal-address-extended-postal-code`
76+
* - `postal-address-locality`
77+
* - `postal-address-region`
78+
* - `postal-code`
79+
* - `street-address`
80+
* - `sms-otp`
81+
* - `tel`
82+
* - `tel-country-code`
83+
* - `tel-national`
84+
* - `tel-device`
85+
* - `username`
86+
* - `username-new`
6387
* - `off`
6488
*
6589
* @platform android
6690
*/
6791
autoComplete: (PropTypes.oneOf([
92+
'birthdate-day',
93+
'birthdate-full',
94+
'birthdate-month',
95+
'birthdate-year',
6896
'cc-csc',
6997
'cc-exp',
98+
'cc-exp-day',
7099
'cc-exp-month',
71100
'cc-exp-year',
72101
'cc-number',
73102
'email',
103+
'gender',
74104
'name',
105+
'name-family',
106+
'name-given',
107+
'name-middle',
108+
'name-middle-initial',
109+
'name-prefix',
110+
'name-suffix',
75111
'password',
112+
'password-new',
113+
'postal-address',
114+
'postal-address-country',
115+
'postal-address-extended',
116+
'postal-address-extended-postal-code',
117+
'postal-address-locality',
118+
'postal-address-region',
76119
'postal-code',
77120
'street-address',
121+
'sms-otp',
78122
'tel',
123+
'tel-country-code',
124+
'tel-national',
125+
'tel-device',
79126
'username',
127+
'username-new',
80128
'off',
81129
]): React$PropType$Primitive<
130+
| 'birthdate-day'
131+
| 'birthdate-full'
132+
| 'birthdate-month'
133+
| 'birthdate-year'
82134
| 'cc-csc'
83135
| 'cc-exp'
136+
| 'cc-exp-day'
84137
| 'cc-exp-month'
85138
| 'cc-exp-year'
86139
| 'cc-number'
87140
| 'email'
141+
| 'gender'
88142
| 'name'
143+
| 'name-family'
144+
| 'name-given'
145+
| 'name-middle'
146+
| 'name-middle-initial'
147+
| 'name-prefix'
148+
| 'name-suffix'
89149
| 'password'
150+
| 'password-new'
151+
| 'postal-address'
152+
| 'postal-address-country'
153+
| 'postal-address-extended'
154+
| 'postal-address-extended-postal-code'
155+
| 'postal-address-locality'
156+
| 'postal-address-region'
90157
| 'postal-code'
91158
| 'street-address'
159+
| 'sms-otp'
92160
| 'tel'
161+
| 'tel-country-code'
162+
| 'tel-national'
163+
| 'tel-device'
93164
| 'username'
165+
| 'username-new'
94166
| 'off',
95167
>),
96168
/**

0 commit comments

Comments
 (0)