Skip to content

Commit b8040b9

Browse files
iRoachieLuna Wei
authored and
Luna Wei
committed
fix(types): cross platform autoComplete for TextInput (#36931)
Summary: Since v0.71 the autoComplete prop on TextInput is available on iOS ([release notes](https://reactnative.dev/blog/2023/01/12/version-071#component-specific-behavior)). However, this change is not reflected in the types. Original types PR here - DefinitelyTyped/DefinitelyTyped#65144 by chwallen ## Changelog: [GENERAL] [FIXED] - Fix autoComplete type for TextInput Pull Request resolved: #36931 Test Plan: Setting the autoComplete prop on TextInput to `nickname`, `organization`, `organization-title`, or `url` should not result in typescript errors. Reviewed By: NickGerleman Differential Revision: D45052350 Pulled By: javache fbshipit-source-id: 40993833b4ed14f91e3bf3521a264ea93517a0c9
1 parent d2a8739 commit b8040b9

File tree

3 files changed

+363
-356
lines changed

3 files changed

+363
-356
lines changed

Libraries/Components/TextInput/TextInput.d.ts

Lines changed: 121 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -279,92 +279,6 @@ export interface TextInputIOSProps {
279279
* @see https://reactnative.dev/docs/textinput#props
280280
*/
281281
export interface TextInputAndroidProps {
282-
/**
283-
* 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.
284-
* To disable autocomplete, set `autoComplete` to `off`.
285-
*
286-
* *Android Only*
287-
*
288-
* Possible values for `autoComplete` are:
289-
*
290-
* - `birthdate-day`
291-
* - `birthdate-full`
292-
* - `birthdate-month`
293-
* - `birthdate-year`
294-
* - `cc-csc`
295-
* - `cc-exp`
296-
* - `cc-exp-day`
297-
* - `cc-exp-month`
298-
* - `cc-exp-year`
299-
* - `cc-number`
300-
* - `email`
301-
* - `gender`
302-
* - `name`
303-
* - `name-family`
304-
* - `name-given`
305-
* - `name-middle`
306-
* - `name-middle-initial`
307-
* - `name-prefix`
308-
* - `name-suffix`
309-
* - `password`
310-
* - `password-new`
311-
* - `postal-address`
312-
* - `postal-address-country`
313-
* - `postal-address-extended`
314-
* - `postal-address-extended-postal-code`
315-
* - `postal-address-locality`
316-
* - `postal-address-region`
317-
* - `postal-code`
318-
* - `street-address`
319-
* - `sms-otp`
320-
* - `tel`
321-
* - `tel-country-code`
322-
* - `tel-national`
323-
* - `tel-device`
324-
* - `username`
325-
* - `username-new`
326-
* - `off`
327-
*/
328-
autoComplete?:
329-
| 'birthdate-day'
330-
| 'birthdate-full'
331-
| 'birthdate-month'
332-
| 'birthdate-year'
333-
| 'cc-csc'
334-
| 'cc-exp'
335-
| 'cc-exp-day'
336-
| 'cc-exp-month'
337-
| 'cc-exp-year'
338-
| 'cc-number'
339-
| 'email'
340-
| 'gender'
341-
| 'name'
342-
| 'name-family'
343-
| 'name-given'
344-
| 'name-middle'
345-
| 'name-middle-initial'
346-
| 'name-prefix'
347-
| 'name-suffix'
348-
| 'password'
349-
| 'password-new'
350-
| 'postal-address'
351-
| 'postal-address-country'
352-
| 'postal-address-extended'
353-
| 'postal-address-extended-postal-code'
354-
| 'postal-address-locality'
355-
| 'postal-address-region'
356-
| 'postal-code'
357-
| 'street-address'
358-
| 'sms-otp'
359-
| 'tel'
360-
| 'tel-country-code'
361-
| 'tel-national'
362-
| 'tel-device'
363-
| 'username'
364-
| 'username-new'
365-
| 'off'
366-
| undefined;
367-
368282
/**
369283
* When provided it will set the color of the cursor (or "caret") in the component.
370284
* Unlike the behavior of `selectionColor` the cursor color will be set independently
@@ -548,6 +462,127 @@ export interface TextInputProps
548462
*/
549463
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters' | undefined;
550464

465+
/**
466+
* Specifies autocomplete hints for the system, so it can provide autofill.
467+
* On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
468+
* To disable autocomplete, set autoComplete to off.
469+
*
470+
* The following values work across platforms:
471+
*
472+
* - `additional-name`
473+
* - `address-line1`
474+
* - `address-line2`
475+
* - `cc-number`
476+
* - `country`
477+
* - `current-password`
478+
* - `email`
479+
* - `family-name`
480+
* - `given-name`
481+
* - `honorific-prefix`
482+
* - `honorific-suffix`
483+
* - `name`
484+
* - `new-password`
485+
* - `off`
486+
* - `one-time-code`
487+
* - `postal-code`
488+
* - `street-address`
489+
* - `tel`
490+
* - `username`
491+
*
492+
* The following values work on iOS only:
493+
*
494+
* - `nickname`
495+
* - `organization`
496+
* - `organization-title`
497+
* - `url`
498+
*
499+
* The following values work on Android only:
500+
*
501+
* - `birthdate-day`
502+
* - `birthdate-full`
503+
* - `birthdate-month`
504+
* - `birthdate-year`
505+
* - `cc-csc`
506+
* - `cc-exp`
507+
* - `cc-exp-day`
508+
* - `cc-exp-month`
509+
* - `cc-exp-year`
510+
* - `gender`
511+
* - `name-family`
512+
* - `name-given`
513+
* - `name-middle`
514+
* - `name-middle-initial`
515+
* - `name-prefix`
516+
* - `name-suffix`
517+
* - `password`
518+
* - `password-new`
519+
* - `postal-address`
520+
* - `postal-address-country`
521+
* - `postal-address-extended`
522+
* - `postal-address-extended-postal-code`
523+
* - `postal-address-locality`
524+
* - `postal-address-region`
525+
* - `sms-otp`
526+
* - `tel-country-code`
527+
* - `tel-national`
528+
* - `tel-device`
529+
* - `username-new`
530+
*/
531+
autoComplete?:
532+
| 'additional-name'
533+
| 'address-line1'
534+
| 'address-line2'
535+
| 'birthdate-day'
536+
| 'birthdate-full'
537+
| 'birthdate-month'
538+
| 'birthdate-year'
539+
| 'cc-csc'
540+
| 'cc-exp'
541+
| 'cc-exp-day'
542+
| 'cc-exp-month'
543+
| 'cc-exp-year'
544+
| 'cc-number'
545+
| 'country'
546+
| 'current-password'
547+
| 'email'
548+
| 'family-name'
549+
| 'gender'
550+
| 'given-name'
551+
| 'honorific-prefix'
552+
| 'honorific-suffix'
553+
| 'name'
554+
| 'name-family'
555+
| 'name-given'
556+
| 'name-middle'
557+
| 'name-middle-initial'
558+
| 'name-prefix'
559+
| 'name-suffix'
560+
| 'new-password'
561+
| 'nickname'
562+
| 'one-time-code'
563+
| 'organization'
564+
| 'organization-title'
565+
| 'password'
566+
| 'password-new'
567+
| 'postal-address'
568+
| 'postal-address-country'
569+
| 'postal-address-extended'
570+
| 'postal-address-extended-postal-code'
571+
| 'postal-address-locality'
572+
| 'postal-address-region'
573+
| 'postal-code'
574+
| 'street-address'
575+
| 'sms-otp'
576+
| 'tel'
577+
| 'tel-country-code'
578+
| 'tel-national'
579+
| 'tel-device'
580+
| 'url'
581+
| 'username'
582+
| 'username-new'
583+
| 'off'
584+
| undefined;
585+
551586
/**
552587
* If false, disables auto-correct.
553588
* The default value is true.

0 commit comments

Comments
 (0)