Skip to content

Commit 4b23deb

Browse files
huntiefacebook-github-bot
authored andcommitted
Add missing textAlignVertical on TextInputAndroidProps (Flow)
Summary: **Motivation** [`textAlignVertical`](https://reactnative.dev/docs/text-style-props#textalignvertical-android) is a real, documented prop which exists on the manual TS types but was not defined in Flow. The prop reaches `<AndroidTextInput>` at runtime via a spread operation: https://www.internalfb.com/code/fbsource/[35bb10d088a0]/xplat/js/react-native-github/packages/react-native/Libraries/Components/TextInput/TextInput.js?lines=653-656 **This change** Type missing prop, exposing this API to Flow and the generated Strict API types — annotated with `platform android`. **Sidenote: Should this prop exist?** `<TextInput>` also respects `style: {verticalAlign: 'auto' | 'bottom' | 'middle' | 'top'}`, mapping this to `textAlignVertical` on Android — **they are equivalent**. Therefore, it's tempting to drop `textAlignVertical` entirely, however neither it nor `style.verticalAlign` are implemented on iOS — therefore the explicit prop with `platform android` edges out. This diff upholds the current state of the world. Changelog: [General][Fixed] - **Strict TypeScript API**: Add missing `textAlignVertical` prop on `<TextInput>` Differential Revision: D106183984
1 parent 97aa7ad commit 4b23deb

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

packages/react-native/Libraries/Components/TextInput/TextInput.flow.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,13 @@ export type TextInputAndroidProps = Readonly<{
506506
*/
507507
textBreakStrategy?: ?('simple' | 'highQuality' | 'balanced'),
508508

509+
/**
510+
* Align the input text to the top, center, or bottom of the field.
511+
* Defaults to `'auto'`.
512+
* @platform android
513+
*/
514+
textAlignVertical?: ?('auto' | 'top' | 'bottom' | 'center'),
515+
509516
/**
510517
* The color of the `TextInput` underline.
511518
* @platform android

packages/react-native/ReactNativeApi.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<67eb674c33870c82986054f0cee48385>>
7+
* @generated SignedSource<<82e308c1a4f2f713285c7586ff3eb618>>
88
*
99
* This file was generated by scripts/js-api/build-types/index.js.
1010
*/
@@ -5051,6 +5051,7 @@ declare type TextInputAndroidProps = {
50515051
readonly rows?: number
50525052
readonly selectionHandleColor?: ColorValue
50535053
readonly showSoftInputOnFocus?: boolean
5054+
readonly textAlignVertical?: "auto" | "bottom" | "center" | "top"
50545055
readonly textBreakStrategy?: "balanced" | "highQuality" | "simple"
50555056
readonly underlineColorAndroid?: ColorValue
50565057
}
@@ -6135,8 +6136,8 @@ export {
61356136
TaskProvider, // 266dedf2
61366137
Text, // f792e51d
61376138
TextContentType, // 239b3ecc
6138-
TextInput, // 1c32d882
6139-
TextInputAndroidProps, // 3f09ce49
6139+
TextInput, // 4d0a088b
6140+
TextInputAndroidProps, // 7109938a
61406141
TextInputBlurEvent, // b77af40e
61416142
TextInputChangeEvent, // f55eef98
61426143
TextInputContentSizeChangeEvent, // a27cd32a
@@ -6145,7 +6146,7 @@ export {
61456146
TextInputIOSProps, // 0d05a855
61466147
TextInputInstance, // 5a0c0e0d
61476148
TextInputKeyPressEvent, // 546c5d07
6148-
TextInputProps, // 08c36ff7
6149+
TextInputProps, // a56c62a0
61496150
TextInputSelectionChangeEvent, // e58f2abc
61506151
TextInputSubmitEditingEvent, // 6bcb2aa5
61516152
TextInstance, // 05463a96

0 commit comments

Comments
 (0)