From d3d48cb357e55b1f2ae0042a5960451fbe5ff5c7 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 10 Sep 2024 05:00:00 -0700 Subject: [PATCH] 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 --- .../Libraries/Components/TextInput/TextInput.d.ts | 6 ++++++ .../Libraries/Components/TextInput/TextInput.flow.js | 5 ++++- .../Libraries/Components/TextInput/TextInput.js | 5 ++++- .../__tests__/__snapshots__/public-api-test.js.snap | 10 ++++++++-- .../js/examples/TextInput/TextInputExample.ios.js | 9 +++++++++ 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.d.ts b/packages/react-native/Libraries/Components/TextInput/TextInput.d.ts index 1481407efee..c1a2a882f94 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.d.ts +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.d.ts @@ -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; /** diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js index e8126e12201..517ccb7c1f7 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js @@ -198,7 +198,10 @@ export type TextContentType = | 'birthdate' | 'birthdateDay' | 'birthdateMonth' - | 'birthdateYear'; + | 'birthdateYear' + | 'dateTime' + | 'flightNumber' + | 'shipmentTrackingNumber'; export type enterKeyHintType = | 'enter' diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index bbeaf8fa53d..684fce0e054 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -238,7 +238,10 @@ export type TextContentType = | 'birthdate' | 'birthdateDay' | 'birthdateMonth' - | 'birthdateYear'; + | 'birthdateYear' + | 'dateTime' + | 'flightNumber' + | 'shipmentTrackingNumber'; export type enterKeyHintType = // Cross Platform diff --git a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap index 9d1d69682d4..a6116afa8c7 100644 --- a/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap +++ b/packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap @@ -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\\" diff --git a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js index d13359827a5..30b8a5dc815 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js @@ -783,6 +783,15 @@ const textInputExamples: Array = [ + + + + + + + + + ); },