feat(JS): Expose text content types to JS (#46170)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46170

This PR expose to JS a few missing text content types on iOS (available from iOS 15)

- dateTime
- flightNumber
- shipmentTrackingNumber

## Changelog
[General][Added] - Expose missing text content type to JS

Reviewed By: blakef

Differential Revision: D61657788

fbshipit-source-id: 1a0ea0e76efaf715d88bcbf249f7cb20b5f3607b
This commit is contained in:
Riccardo Cipolleschi
2024-09-10 05:00:00 -07:00
committed by Facebook GitHub Bot
parent ce2d34f194
commit d3d48cb357
5 changed files with 31 additions and 4 deletions
@@ -255,6 +255,9 @@ export interface TextInputIOSProps {
* - `'birthdateDay'` (iOS 17+)
* - `'birthdateMonth'` (iOS 17+)
* - `'birthdateYear'` (iOS 17+)
* - `'dateTime'` (iOS 15+)
* - `'flightNumber'` (iOS 15+)
* - `'shipmentTrackingNumber'` (iOS 15+)
*
*/
textContentType?:
@@ -299,6 +302,9 @@ export interface TextInputIOSProps {
| 'birthdateDay'
| 'birthdateMonth'
| 'birthdateYear'
| 'dateTime'
| 'flightNumber'
| 'shipmentTrackingNumber'
| undefined;
/**
@@ -198,7 +198,10 @@ export type TextContentType =
| 'birthdate'
| 'birthdateDay'
| 'birthdateMonth'
| 'birthdateYear';
| 'birthdateYear'
| 'dateTime'
| 'flightNumber'
| 'shipmentTrackingNumber';
export type enterKeyHintType =
| 'enter'
@@ -238,7 +238,10 @@ export type TextContentType =
| 'birthdate'
| 'birthdateDay'
| 'birthdateMonth'
| 'birthdateYear';
| 'birthdateYear'
| 'dateTime'
| 'flightNumber'
| 'shipmentTrackingNumber';
export type enterKeyHintType =
// Cross Platform
@@ -2899,7 +2899,10 @@ export type TextContentType =
| \\"birthdate\\"
| \\"birthdateDay\\"
| \\"birthdateMonth\\"
| \\"birthdateYear\\";
| \\"birthdateYear\\"
| \\"dateTime\\"
| \\"flightNumber\\"
| \\"shipmentTrackingNumber\\";
export type enterKeyHintType =
| \\"enter\\"
| \\"done\\"
@@ -3252,7 +3255,10 @@ export type TextContentType =
| \\"birthdate\\"
| \\"birthdateDay\\"
| \\"birthdateMonth\\"
| \\"birthdateYear\\";
| \\"birthdateYear\\"
| \\"dateTime\\"
| \\"flightNumber\\"
| \\"shipmentTrackingNumber\\";
export type enterKeyHintType =
| \\"done\\"
| \\"go\\"
@@ -783,6 +783,15 @@ const textInputExamples: Array<RNTesterModuleExample> = [
<WithLabel label="birthdate">
<ExampleTextInput textContentType="birthdate" />
</WithLabel>
<WithLabel label="dateTime">
<ExampleTextInput textContentType="dateTime" />
</WithLabel>
<WithLabel label="flightNumber">
<ExampleTextInput textContentType="flightNumber" />
</WithLabel>
<WithLabel label="shipmentTrackingNumber">
<ExampleTextInput textContentType="shipmentTrackingNumber" />
</WithLabel>
</View>
);
},