Skip to content

Commit 94356e1

Browse files
iRoachiefacebook-github-bot
authored andcommitted
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 eb30a80 commit 94356e1

File tree

3 files changed

+363
-356
lines changed

3 files changed

+363
-356
lines changed

packages/react-native/Libraries/Components/TextInput/TextInput.d.ts

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

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

0 commit comments

Comments
 (0)