diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js index 2c236d03f86..5fecbfdb292 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js @@ -23,13 +23,17 @@ import { } from '../../StyleSheet/StyleSheet'; import * as React from 'react'; +/** + * @see TextInputProps.onChange + */ type TextInputChangeEventData = $ReadOnly<{ eventCount: number, target: number, text: string, }>; -type TextInputChangeEvent = NativeSyntheticEvent; +export type TextInputChangeEvent = + NativeSyntheticEvent; export type TextInputEvent = NativeSyntheticEvent< $ReadOnly<{ @@ -52,19 +56,30 @@ type TextInputContentSizeChangeEventData = $ReadOnly<{ }>, }>; +/** + * @see TextInputProps.onContentSizeChange + */ export type TextInputContentSizeChangeEvent = NativeSyntheticEvent; type TargetEvent = $ReadOnly<{ target: number, + ... }>; type TextInputFocusEventData = TargetEvent; +/** + * @see TextInputProps.onBlur + */ export type TextInputBlurEvent = NativeSyntheticEvent; + +/** + * @see TextInputProps.onFocus + */ export type TextInputFocusEvent = NativeSyntheticEvent; -type Selection = $ReadOnly<{ +export type Selection = $ReadOnly<{ start: number, end: number, }>; @@ -72,8 +87,12 @@ type Selection = $ReadOnly<{ type TextInputSelectionChangeEventData = $ReadOnly<{ ...TargetEvent, selection: Selection, + ... }>; +/** + * @see TextInputProps.onSelectionChange + */ export type TextInputSelectionChangeEvent = NativeSyntheticEvent; @@ -82,8 +101,12 @@ type TextInputKeyPressEventData = $ReadOnly<{ key: string, target?: ?number, eventCount: number, + ... }>; +/** + * @see TextInputProps.onKeyPress + */ export type TextInputKeyPressEvent = NativeSyntheticEvent; @@ -91,6 +114,7 @@ type TextInputEndEditingEventData = $ReadOnly<{ ...TargetEvent, eventCount: number, text: string, + ... }>; /** @@ -103,6 +127,7 @@ type TextInputSubmitEditingEventData = $ReadOnly<{ ...TargetEvent, eventCount: number, text: string, + ... }>; /** @@ -488,11 +513,7 @@ export type TextInputAndroidProps = $ReadOnly<{ underlineColorAndroid?: ?ColorValue, }>; -export type TextInputProps = $ReadOnly<{ - ...$Diff>, - ...TextInputIOSProps, - ...TextInputAndroidProps, - +type TextInputBaseProps = $ReadOnly<{ /** * Can tell `TextInput` to automatically capitalize certain characters. * @@ -776,33 +797,12 @@ export type TextInputProps = $ReadOnly<{ */ onChange?: ?(e: TextInputChangeEvent) => mixed, - /** - * DANGER: this API is not stable and will change in the future. - * - * Callback will be called on the main thread and may result in dropped frames. - * Callback that is called when the text input's text changes. - * - * @platform ios - */ - unstable_onChangeSync?: ?(e: TextInputChangeEvent) => mixed, - /** * Callback that is called when the text input's text changes. * Changed text is passed as an argument to the callback handler. */ onChangeText?: ?(text: string) => mixed, - /** - * DANGER: this API is not stable and will change in the future. - * - * Callback will be called on the main thread and may result in dropped frames. - * Callback that is called when the text input's text changes. - * Changed text is passed as an argument to the callback handler. - * - * @platform ios - */ - unstable_onChangeTextSync?: ?(text: string) => mixed, - /** * Callback that is called when the text input's content size changes. * This will be called with @@ -831,21 +831,6 @@ export type TextInputProps = $ReadOnly<{ */ onKeyPress?: ?(e: TextInputKeyPressEvent) => mixed, - /** - * DANGER: this API is not stable and will change in the future. - * - * Callback will be called on the main thread and may result in dropped frames. - * - * Callback that is called when a key is pressed. - * This will be called with `{ nativeEvent: { key: keyValue } }` - * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and - * the typed-in character otherwise including `' '` for space. - * Fires before `onChange` callbacks. - * - * @platform ios - */ - unstable_onKeyPressSync?: ?(e: TextInputKeyPressEvent) => mixed, - /** * Called when a single tap gesture is detected. */ @@ -1022,6 +1007,13 @@ export type TextInputProps = $ReadOnly<{ value?: ?Stringish, }>; +export type TextInputProps = $ReadOnly<{ + ...$Diff>, + ...TextInputIOSProps, + ...TextInputAndroidProps, + ...TextInputBaseProps, +}>; + export interface TextInputInstance extends HostInstance { +clear: () => void; +isFocused: () => boolean; diff --git a/packages/react-native/Libraries/Components/TextInput/TextInput.js b/packages/react-native/Libraries/Components/TextInput/TextInput.js index af3560f265f..b56c388d88c 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInput.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInput.js @@ -12,19 +12,46 @@ import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {____TextStyle_Internal as TextStyleInternal} from '../../StyleSheet/StyleSheetTypes'; import type { GestureResponderEvent, - NativeSyntheticEvent, ScrollEvent, } from '../../Types/CoreEventTypes'; -import type {ViewProps} from '../View/ViewPropTypes'; -import type {TextInputInstance, TextInputType} from './TextInput.flow'; +import type { + AutoCapitalize, + EnterKeyHintType, + EnterKeyHintTypeAndroid, + EnterKeyHintTypeIOS, + EnterKeyHintTypeOptions, + InputModeOptions, + KeyboardType, + KeyboardTypeAndroid, + KeyboardTypeIOS, + KeyboardTypeOptions, + ReturnKeyType, + ReturnKeyTypeAndroid, + ReturnKeyTypeIOS, + ReturnKeyTypeOptions, + Selection, + SubmitBehavior, + TextContentType, + TextInputAndroidProps, + TextInputBlurEvent, + TextInputChangeEvent, + TextInputContentSizeChangeEvent, + TextInputEditingEvent, + TextInputEndEditingEvent, + TextInputEvent, + TextInputFocusEvent, + TextInputInstance, + TextInputIOSProps, + TextInputKeyPressEvent, + TextInputProps, + TextInputSelectionChangeEvent, + TextInputSubmitEditingEvent, + TextInputType, +} from './TextInput.flow'; import usePressability from '../../Pressability/usePressability'; import flattenStyle from '../../StyleSheet/flattenStyle'; -import StyleSheet, { - type ColorValue, - type TextStyleProp, - type ViewStyleProp, -} from '../../StyleSheet/StyleSheet'; +import StyleSheet, {type TextStyleProp} from '../../StyleSheet/StyleSheet'; import Text from '../../Text/Text'; import TextAncestor from '../../Text/TextAncestor'; import Platform from '../../Utilities/Platform'; @@ -57,1005 +84,38 @@ if (Platform.OS === 'android') { require('./RCTMultilineTextInputNativeComponent').Commands; } -/** - * @see TextInputProps.onChange - */ -type TextInputChangeEventData = $ReadOnly<{ - eventCount: number, - target: number, - text: string, -}>; - -export type TextInputChangeEvent = - NativeSyntheticEvent; - -export type TextInputEvent = NativeSyntheticEvent< - $ReadOnly<{ - eventCount: number, - previousText: string, - range: $ReadOnly<{ - start: number, - end: number, - }>, - target: number, - text: string, - }>, ->; - -type TextInputContentSizeChangeEventData = $ReadOnly<{ - target: number, - contentSize: $ReadOnly<{ - width: number, - height: number, - }>, -}>; - -/** - * @see TextInputProps.onContentSizeChange - */ -export type TextInputContentSizeChangeEvent = - NativeSyntheticEvent; - -export type TargetEvent = $ReadOnly<{ - target: number, -}>; - -type TextInputFocusEventData = TargetEvent; - -/** - * @see TextInputProps.onBlur - */ -export type TextInputBlurEvent = NativeSyntheticEvent; - -/** - * @see TextInputProps.onFocus - */ -export type TextInputFocusEvent = NativeSyntheticEvent; - -type TextInputScrollEventData = { - contentOffset: {x: number, y: number}, +export type { + AutoCapitalize, + EnterKeyHintType, + EnterKeyHintTypeAndroid, + EnterKeyHintTypeIOS, + EnterKeyHintTypeOptions, + InputModeOptions, + KeyboardType, + KeyboardTypeAndroid, + KeyboardTypeIOS, + KeyboardTypeOptions, + ReturnKeyType, + ReturnKeyTypeAndroid, + ReturnKeyTypeIOS, + ReturnKeyTypeOptions, + SubmitBehavior, + TextContentType, + TextInputAndroidProps, + TextInputBlurEvent, + TextInputChangeEvent, + TextInputContentSizeChangeEvent, + TextInputEditingEvent, + TextInputEndEditingEvent, + TextInputEvent, + TextInputFocusEvent, + TextInputIOSProps, + TextInputKeyPressEvent, + TextInputProps, + TextInputSelectionChangeEvent, + TextInputSubmitEditingEvent, }; -/** - * @see TextInputProps.onScroll - */ -export type TextInputScrollEvent = - NativeSyntheticEvent; - -type Selection = $ReadOnly<{ - start: number, - end: number, -}>; - -type TextInputSelectionChangeEventData = $ReadOnly<{ - ...TargetEvent, - selection: Selection, -}>; - -/** - * @see TextInputProps.onSelectionChange - */ -export type TextInputSelectionChangeEvent = - NativeSyntheticEvent; - -type TextInputKeyPressEventData = $ReadOnly<{ - ...TargetEvent, - key: string, - target?: ?number, - eventCount?: ?number, -}>; - -/** - * @see TextInputProps.onKeyPress - */ -export type TextInputKeyPressEvent = - NativeSyntheticEvent; - -type TextInputEndEditingEventData = $ReadOnly<{ - ...TargetEvent, - eventCount: number, - text: string, -}>; - -/** - * @see TextInputProps.onEndEditing - */ -export type TextInputEndEditingEvent = - NativeSyntheticEvent; - -type TextInputSubmitEditingEventData = $ReadOnly<{ - ...TargetEvent, - eventCount: number, - text: string, -}>; - -/** - * @see TextInputProps.onSubmitEditing - */ -export type TextInputSubmitEditingEvent = - NativeSyntheticEvent; - -export type TextInputEditingEvent = - NativeSyntheticEvent; - -type DataDetectorTypesType = - | 'phoneNumber' - | 'link' - | 'address' - | 'calendarEvent' - | 'trackingNumber' - | 'flightNumber' - | 'lookupSuggestion' - | 'none' - | 'all'; - -export type KeyboardType = - | 'default' - | 'email-address' - | 'numeric' - | 'phone-pad' - | 'number-pad' - | 'decimal-pad' - | 'url'; - -export type KeyboardTypeIOS = - | 'ascii-capable' - | 'numbers-and-punctuation' - | 'name-phone-pad' - | 'twitter' - | 'web-search' - // iOS 10+ only - | 'ascii-capable-number-pad'; - -export type KeyboardTypeAndroid = 'visible-password'; - -export type KeyboardTypeOptions = - | KeyboardType - | KeyboardTypeIOS - | KeyboardTypeAndroid; - -export type InputModeOptions = - | 'none' - | 'text' - | 'decimal' - | 'numeric' - | 'tel' - | 'search' - | 'email' - | 'url'; - -export type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send'; - -export type ReturnKeyTypeIOS = - | 'default' - | 'emergency-call' - | 'google' - | 'join' - | 'route' - | 'yahoo'; - -export type ReturnKeyTypeAndroid = 'none' | 'previous'; - -export type ReturnKeyTypeOptions = - | ReturnKeyType - | ReturnKeyTypeIOS - | ReturnKeyTypeAndroid; - -export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline'; - -export type AutoCapitalize = 'none' | 'sentences' | 'words' | 'characters'; - -export type TextContentType = - | 'none' - | 'URL' - | 'addressCity' - | 'addressCityAndState' - | 'addressState' - | 'countryName' - | 'creditCardNumber' - | 'creditCardExpiration' - | 'creditCardExpirationMonth' - | 'creditCardExpirationYear' - | 'creditCardSecurityCode' - | 'creditCardType' - | 'creditCardName' - | 'creditCardGivenName' - | 'creditCardMiddleName' - | 'creditCardFamilyName' - | 'emailAddress' - | 'familyName' - | 'fullStreetAddress' - | 'givenName' - | 'jobTitle' - | 'location' - | 'middleName' - | 'name' - | 'namePrefix' - | 'nameSuffix' - | 'nickname' - | 'organizationName' - | 'postalCode' - | 'streetAddressLine1' - | 'streetAddressLine2' - | 'sublocality' - | 'telephoneNumber' - | 'username' - | 'password' - | 'newPassword' - | 'oneTimeCode' - | 'birthdate' - | 'birthdateDay' - | 'birthdateMonth' - | 'birthdateYear' - | 'cellularEID' - | 'cellularIMEI' - | 'dateTime' - | 'flightNumber' - | 'shipmentTrackingNumber'; - -export type EnterKeyHintTypeAndroid = 'previous'; - -export type EnterKeyHintTypeIOS = 'enter'; - -export type EnterKeyHintType = 'done' | 'go' | 'next' | 'search' | 'send'; - -export type EnterKeyHintTypeOptions = - | EnterKeyHintType - | EnterKeyHintTypeAndroid - | EnterKeyHintTypeIOS; - -type PasswordRules = string; - -export type TextInputIOSProps = $ReadOnly<{ - /** - * If true, the keyboard shortcuts (undo/redo and copy buttons) are disabled. The default value is false. - * @platform ios - */ - disableKeyboardShortcuts?: ?boolean, - - /** - * When the clear button should appear on the right side of the text view. - * This property is supported only for single-line TextInput component. - * @platform ios - */ - clearButtonMode?: ?('never' | 'while-editing' | 'unless-editing' | 'always'), - - /** - * If `true`, clears the text field automatically when editing begins. - * @platform ios - */ - clearTextOnFocus?: ?boolean, - - /** - * Determines the types of data converted to clickable URLs in the text input. - * Only valid if `multiline={true}` and `editable={false}`. - * By default no data types are detected. - * - * You can provide one type or an array of many types. - * - * Possible values for `dataDetectorTypes` are: - * - * - `'phoneNumber'` - * - `'link'` - * - `'address'` - * - `'calendarEvent'` - * - `'none'` - * - `'all'` - * - * @platform ios - */ - dataDetectorTypes?: - | ?DataDetectorTypesType - | $ReadOnlyArray, - - /** - * If `true`, the keyboard disables the return key when there is no text and - * automatically enables it when there is text. The default value is `false`. - * @platform ios - */ - enablesReturnKeyAutomatically?: ?boolean, - - /** - * An optional identifier which links a custom InputAccessoryView to - * this text input. The InputAccessoryView is rendered above the - * keyboard when this text input is focused. - * @platform ios - */ - inputAccessoryViewID?: ?string, - - /** - * An optional label that overrides the default input accessory view button label. - * @platform ios - */ - inputAccessoryViewButtonLabel?: ?string, - - /** - * Determines the color of the keyboard. - * @platform ios - */ - keyboardAppearance?: ?('default' | 'light' | 'dark'), - - /** - * Provide rules for your password. - * For example, say you want to require a password with at least eight characters consisting of a mix of uppercase and lowercase letters, at least one number, and at most two consecutive characters. - * "required: upper; required: lower; required: digit; max-consecutive: 2; minlength: 8;" - * @platform ios - */ - passwordRules?: ?PasswordRules, - - /* - * If `true`, allows TextInput to pass touch events to the parent component. - * This allows components to be swipeable from the TextInput on iOS, - * as is the case on Android by default. - * If `false`, TextInput always asks to handle the input (except when disabled). - * @platform ios - */ - rejectResponderTermination?: ?boolean, - - /** - * If `false`, scrolling of the text view will be disabled. - * The default value is `true`. Does only work with 'multiline={true}'. - * @platform ios - */ - scrollEnabled?: ?boolean, - - /** - * If `false`, disables spell-check style (i.e. red underlines). - * The default value is inherited from `autoCorrect`. - * @platform ios - */ - spellCheck?: ?boolean, - - /** - * Give the keyboard and the system information about the - * expected semantic meaning for the content that users enter. - * `autoComplete` property accomplishes same behavior and is recommended as its supported by both platforms. - * Avoid using both `autoComplete` and `textContentType`, you can use `Platform.select` for differing platform behaviors. - * For backwards compatibility, when both set, `textContentType` takes precedence on iOS. - * @platform ios - */ - textContentType?: ?TextContentType, - - /** - * Set line break strategy on iOS. - * @platform ios - */ - lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'), - - /** - * Set line break mode on iOS. - * @platform ios - */ - lineBreakModeIOS?: ?( - | 'wordWrapping' - | 'char' - | 'clip' - | 'head' - | 'middle' - | 'tail' - ), - - /** - * If `false`, the iOS system will not insert an extra space after a paste operation - * neither delete one or two spaces after a cut or delete operation. - * - * The default value is `true`. - * - * @platform ios - */ - smartInsertDelete?: ?boolean, -}>; - -export type TextInputAndroidProps = $ReadOnly<{ - /** - * When provided it will set the color of the cursor (or "caret") in the component. - * Unlike the behavior of `selectionColor` the cursor color will be set independently - * from the color of the text selection box. - * @platform android - */ - cursorColor?: ?ColorValue, - - /** - * When `false`, if there is a small amount of space available around a text input - * (e.g. landscape orientation on a phone), the OS may choose to have the user edit - * the text inside of a full screen text input mode. When `true`, this feature is - * disabled and users will always edit the text directly inside of the text input. - * Defaults to `false`. - * @platform android - */ - disableFullscreenUI?: ?boolean, - - /** - * Determines whether the individual fields in your app should be included in a - * view structure for autofill purposes on Android API Level 26+. Defaults to auto. - * To disable auto complete, use `off`. - * - * *Android Only* - * - * The following values work on Android only: - * - * - `auto` - let Android decide - * - `no` - not important for autofill - * - `noExcludeDescendants` - this view and its children aren't important for autofill - * - `yes` - is important for autofill - * - `yesExcludeDescendants` - this view is important for autofill but its children aren't - */ - importantForAutofill?: ?( - | 'auto' - | 'no' - | 'noExcludeDescendants' - | 'yes' - | 'yesExcludeDescendants' - ), - - /** - * If defined, the provided image resource will be rendered on the left. - * The image resource must be inside `/android/app/src/main/res/drawable` and referenced - * like - * ``` - * - * ``` - * @platform android - */ - inlineImageLeft?: ?string, - - /** - * Padding between the inline image, if any, and the text input itself. - * @platform android - */ - inlineImagePadding?: ?number, - - /** - * Sets the number of lines for a `TextInput`. Use it with multiline set to - * `true` to be able to fill the lines. - * @platform android - */ - numberOfLines?: ?number, - - /** - * Sets the return key to the label. Use it instead of `returnKeyType`. - * @platform android - */ - returnKeyLabel?: ?string, - - /** - * Sets the number of rows for a `TextInput`. Use it with multiline set to - * `true` to be able to fill the lines. - * @platform android - */ - rows?: ?number, - - /** - * When `false`, it will prevent the soft keyboard from showing when the field is focused. - * Defaults to `true`. - */ - showSoftInputOnFocus?: ?boolean, - - /** - * Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced` - * The default value is `simple`. - * @platform android - */ - textBreakStrategy?: ?('simple' | 'highQuality' | 'balanced'), - - /** - * The color of the `TextInput` underline. - * @platform android - */ - underlineColorAndroid?: ?ColorValue, -}>; - -type TextInputBaseProps = $ReadOnly<{ - /** - * Can tell `TextInput` to automatically capitalize certain characters. - * - * - `characters`: all characters. - * - `words`: first letter of each word. - * - `sentences`: first letter of each sentence (*default*). - * - `none`: don't auto capitalize anything. - */ - autoCapitalize?: ?AutoCapitalize, - - /** - * 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. - * To disable autocomplete, set autoComplete to off. - * - * The following values work across platforms: - * - * - `additional-name` - * - `address-line1` - * - `address-line2` - * - `birthdate-day` (iOS 17+) - * - `birthdate-full` (iOS 17+) - * - `birthdate-month` (iOS 17+) - * - `birthdate-year` (iOS 17+) - * - `cc-number` - * - `cc-csc` (iOS 17+) - * - `cc-exp` (iOS 17+) - * - `cc-exp-day` (iOS 17+) - * - `cc-exp-month` (iOS 17+) - * - `cc-exp-year` (iOS 17+) - * - `country` - * - `current-password` - * - `email` - * - `family-name` - * - `given-name` - * - `honorific-prefix` - * - `honorific-suffix` - * - `name` - * - `new-password` - * - `off` - * - `one-time-code` - * - `postal-code` - * - `street-address` - * - `tel` - * - `username` - * - * The following values work on iOS only: - * - * - `cc-name` (iOS 17+) - * - `cc-given-name` (iOS 17+) - * - `cc-middle-name` (iOS 17+) - * - `cc-family-name` (iOS 17+) - * - `cc-type` (iOS 17+) - * - `nickname` - * - `organization` - * - `organization-title` - * - `url` - * - * The following values work on Android only: - * - * - `gender` - * - `name-family` - * - `name-given` - * - `name-middle` - * - `name-middle-initial` - * - `name-prefix` - * - `name-suffix` - * - `password` - * - `password-new` - * - `postal-address` - * - `postal-address-country` - * - `postal-address-extended` - * - `postal-address-extended-postal-code` - * - `postal-address-locality` - * - `postal-address-region` - * - `sms-otp` - * - `tel-country-code` - * - `tel-national` - * - `tel-device` - * - `username-new` - */ - autoComplete?: ?( - | 'additional-name' - | 'address-line1' - | 'address-line2' - | 'birthdate-day' - | 'birthdate-full' - | 'birthdate-month' - | 'birthdate-year' - | 'cc-csc' - | 'cc-exp' - | 'cc-exp-day' - | 'cc-exp-month' - | 'cc-exp-year' - | 'cc-number' - | 'cc-name' - | 'cc-given-name' - | 'cc-middle-name' - | 'cc-family-name' - | 'cc-type' - | 'country' - | 'current-password' - | 'email' - | 'family-name' - | 'gender' - | 'given-name' - | 'honorific-prefix' - | 'honorific-suffix' - | 'name' - | 'name-family' - | 'name-given' - | 'name-middle' - | 'name-middle-initial' - | 'name-prefix' - | 'name-suffix' - | 'new-password' - | 'nickname' - | 'one-time-code' - | 'organization' - | 'organization-title' - | 'password' - | 'password-new' - | 'postal-address' - | 'postal-address-country' - | 'postal-address-extended' - | 'postal-address-extended-postal-code' - | 'postal-address-locality' - | 'postal-address-region' - | 'postal-code' - | 'street-address' - | 'sms-otp' - | 'tel' - | 'tel-country-code' - | 'tel-national' - | 'tel-device' - | 'url' - | 'username' - | 'username-new' - | 'off' - ), - - /** - * If `false`, disables auto-correct. The default value is `true`. - */ - autoCorrect?: ?boolean, - - /** - * If `true`, focuses the input on `componentDidMount`. - * The default value is `false`. - */ - autoFocus?: ?boolean, - - /** - * Specifies whether fonts should scale to respect Text Size accessibility settings. The - * default is `true`. - */ - allowFontScaling?: ?boolean, - - /** - * If `true`, caret is hidden. The default value is `false`. - * - * On Android devices manufactured by Xiaomi with Android Q, - * when keyboardType equals 'email-address'this will be set - * in native to 'true' to prevent a system related crash. This - * will cause cursor to be disabled as a side-effect. - * - */ - caretHidden?: ?boolean, - - /* - * If `true`, contextMenuHidden is hidden. The default value is `false`. - */ - contextMenuHidden?: ?boolean, - - /** - * Provides an initial value that will change when the user starts typing. - * Useful for simple use-cases where you do not want to deal with listening - * to events and updating the value prop to keep the controlled state in sync. - */ - defaultValue?: ?Stringish, - - /** - * If `false`, text is not editable. The default value is `true`. - */ - editable?: ?boolean, - - forwardedRef?: ?React.RefSetter, - - /** - * `enterKeyHint` defines what action label (or icon) to present for the enter key on virtual keyboards. - * - * The following values is supported: - * - * - `enter` - * - `done` - * - `go` - * - `next` - * - `previous` - * - `search` - * - `send` - */ - enterKeyHint?: ?EnterKeyHintTypeOptions, - - /** - * `inputMode` works like the `inputmode` attribute in HTML, it determines which - * keyboard to open, e.g.`numeric` and has precedence over keyboardType - * - * Support the following values: - * - * - `none` - * - `text` - * - `decimal` - * - `numeric` - * - `tel` - * - `search` - * - `email` - * - `url` - */ - inputMode?: ?InputModeOptions, - - /** - * Determines which keyboard to open, e.g.`numeric`. - * - * The following values work across platforms: - * - * - `default` - * - `numeric` - * - `number-pad` - * - `decimal-pad` - * - `email-address` - * - `phone-pad` - * - `url` - * - * *iOS Only* - * - * The following values work on iOS only: - * - * - `ascii-capable` - * - `numbers-and-punctuation` - * - `name-phone-pad` - * - `twitter` - * - `web-search` - * - * *Android Only* - * - * The following values work on Android only: - * - * - `visible-password` - * - */ - keyboardType?: ?KeyboardTypeOptions, - - /** - * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. - * Possible values: - * `null/undefined` (default): inherit from the parent node or the global default (0) - * `0`: no max, ignore parent/global default - * `>= 1`: sets the maxFontSizeMultiplier of this node to this value - */ - maxFontSizeMultiplier?: ?number, - - /** - * Limits the maximum number of characters that can be entered. Use this - * instead of implementing the logic in JS to avoid flicker. - */ - maxLength?: ?number, - - /** - * If `true`, the text input can be multiple lines. - * The default value is `false`. - */ - multiline?: ?boolean, - - /** - * Callback that is called when the text input is blurred. - */ - onBlur?: ?(e: TextInputBlurEvent) => mixed, - - /** - * Callback that is called when the text input's text changes. - */ - onChange?: ?(e: TextInputChangeEvent) => mixed, - - /** - * Callback that is called when the text input's text changes. - * Changed text is passed as an argument to the callback handler. - */ - onChangeText?: ?(text: string) => mixed, - - /** - * Callback that is called when the text input's content size changes. - * This will be called with - * `{ nativeEvent: { contentSize: { width, height } } }`. - * - * Only called for multiline text inputs. - */ - onContentSizeChange?: ?(e: TextInputContentSizeChangeEvent) => mixed, - - /** - * Callback that is called when text input ends. - */ - onEndEditing?: ?(e: TextInputEndEditingEvent) => mixed, - - /** - * Callback that is called when the text input is focused. - */ - onFocus?: ?(e: TextInputFocusEvent) => mixed, - - /** - * Callback that is called when a key is pressed. - * This will be called with `{ nativeEvent: { key: keyValue } }` - * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and - * the typed-in character otherwise including `' '` for space. - * Fires before `onChange` callbacks. - */ - onKeyPress?: ?(e: TextInputKeyPressEvent) => mixed, - - /** - * Called when a single tap gesture is detected. - */ - onPress?: ?(event: GestureResponderEvent) => mixed, - - /** - * Called when a touch is engaged. - */ - onPressIn?: ?(event: GestureResponderEvent) => mixed, - - /** - * Called when a touch is released. - */ - onPressOut?: ?(event: GestureResponderEvent) => mixed, - - /** - * Callback that is called when the text input selection is changed. - * This will be called with - * `{ nativeEvent: { selection: { start, end } } }`. - */ - onSelectionChange?: ?(e: TextInputSelectionChangeEvent) => mixed, - - /** - * Callback that is called when the text input's submit button is pressed. - * Invalid if `multiline={true}` is specified. - */ - onSubmitEditing?: ?(e: TextInputSubmitEditingEvent) => mixed, - - /** - * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`. - * May also contain other properties from ScrollEvent but on Android contentSize - * is not provided for performance reasons. - */ - onScroll?: ?(e: ScrollEvent) => mixed, - - /** - * The string that will be rendered before text input has been entered. - */ - placeholder?: ?Stringish, - - /** - * The text color of the placeholder string. - */ - placeholderTextColor?: ?ColorValue, - - /** `readOnly` works like the `readonly` attribute in HTML. - * If `true`, text is not editable. The default value is `false`. - * See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly - * for more details. - */ - readOnly?: ?boolean, - - /** - * Determines how the return key should look. On Android you can also use - * `returnKeyLabel`. - * - * *Cross platform* - * - * The following values work across platforms: - * - * - `done` - * - `go` - * - `next` - * - `search` - * - `send` - * - * *Android Only* - * - * The following values work on Android only: - * - * - `none` - * - `previous` - * - * *iOS Only* - * - * The following values work on iOS only: - * - * - `default` - * - `emergency-call` - * - `google` - * - `join` - * - `route` - * - `yahoo` - */ - returnKeyType?: ?ReturnKeyTypeOptions, - - /** - * If `true`, the text input obscures the text entered so that sensitive text - * like passwords stay secure. The default value is `false`. Does not work with 'multiline={true}'. - */ - secureTextEntry?: ?boolean, - - /** - * The start and end of the text input's selection. Set start and end to - * the same value to position the cursor. - */ - selection?: ?$ReadOnly<{ - start: number, - end?: ?number, - }>, - - /** - * The highlight and cursor color of the text input. - */ - selectionColor?: ?ColorValue, - - /** - * When provided it will set the color of the selection handles when highlighting text. - * Unlike the behavior of `selectionColor` the handle color will be set independently - * from the color of the text selection box. - * @platform android - */ - selectionHandleColor?: ?ColorValue, - - /** - * If `true`, all text will automatically be selected on focus. - */ - selectTextOnFocus?: ?boolean, - - /** - * If `true`, the text field will blur when submitted. - * The default value is true for single-line fields and false for - * multiline fields. Note that for multiline fields, setting `blurOnSubmit` - * to `true` means that pressing return will blur the field and trigger the - * `onSubmitEditing` event instead of inserting a newline into the field. - * - * @deprecated - * Note that `submitBehavior` now takes the place of `blurOnSubmit` and will - * override any behavior defined by `blurOnSubmit`. - * @see submitBehavior - */ - blurOnSubmit?: ?boolean, - - /** - * When the return key is pressed, - * - * For single line inputs: - * - * - `'newline`' defaults to `'blurAndSubmit'` - * - `undefined` defaults to `'blurAndSubmit'` - * - * For multiline inputs: - * - * - `'newline'` adds a newline - * - `undefined` defaults to `'newline'` - * - * For both single line and multiline inputs: - * - * - `'submit'` will only send a submit event and not blur the input - * - `'blurAndSubmit`' will both blur the input and send a submit event - */ - submitBehavior?: ?SubmitBehavior, - - /** - * Note that not all Text styles are supported, an incomplete list of what is not supported includes: - * - * - `borderLeftWidth` - * - `borderTopWidth` - * - `borderRightWidth` - * - `borderBottomWidth` - * - `borderTopLeftRadius` - * - `borderTopRightRadius` - * - `borderBottomRightRadius` - * - `borderBottomLeftRadius` - * - * see [Issue#7070](https://github.com/facebook/react-native/issues/7070) - * for more detail. - * - * [Styles](docs/style.html) - */ - style?: ?TextStyleProp, - - /** - * The value to show for the text input. `TextInput` is a controlled - * component, which means the native value will be forced to match this - * value prop if provided. For most uses, this works great, but in some - * cases this may cause flickering - one common cause is preventing edits - * by keeping value the same. In addition to simply setting the same value, - * either set `editable={false}`, or set/update `maxLength` to prevent - * unwanted edits without flicker. - */ - value?: ?Stringish, -}>; - -export type TextInputProps = $ReadOnly<{ - ...$Diff>, - ...TextInputIOSProps, - ...TextInputAndroidProps, - ...TextInputBaseProps, -}>; - type TextInputStateType = $ReadOnly<{ /** * @deprecated Use currentlyFocusedInput 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 568571c3235..d54ab130f4d 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 @@ -2659,7 +2659,8 @@ exports[`public API should not change unintentionally Libraries/Components/TextI target: number, text: string, }>; -type TextInputChangeEvent = NativeSyntheticEvent; +export type TextInputChangeEvent = + NativeSyntheticEvent; export type TextInputEvent = NativeSyntheticEvent< $ReadOnly<{ eventCount: number, @@ -2683,17 +2684,19 @@ export type TextInputContentSizeChangeEvent = NativeSyntheticEvent; type TargetEvent = $ReadOnly<{ target: number, + ... }>; type TextInputFocusEventData = TargetEvent; export type TextInputBlurEvent = NativeSyntheticEvent; export type TextInputFocusEvent = NativeSyntheticEvent; -type Selection = $ReadOnly<{ +export type Selection = $ReadOnly<{ start: number, end: number, }>; type TextInputSelectionChangeEventData = $ReadOnly<{ ...TargetEvent, selection: Selection, + ... }>; export type TextInputSelectionChangeEvent = NativeSyntheticEvent; @@ -2702,6 +2705,7 @@ type TextInputKeyPressEventData = $ReadOnly<{ key: string, target?: ?number, eventCount: number, + ... }>; export type TextInputKeyPressEvent = NativeSyntheticEvent; @@ -2709,6 +2713,7 @@ type TextInputEndEditingEventData = $ReadOnly<{ ...TargetEvent, eventCount: number, text: string, + ... }>; export type TextInputEndEditingEvent = NativeSyntheticEvent; @@ -2716,6 +2721,7 @@ type TextInputSubmitEditingEventData = $ReadOnly<{ ...TargetEvent, eventCount: number, text: string, + ... }>; export type TextInputSubmitEditingEvent = NativeSyntheticEvent; @@ -2877,367 +2883,6 @@ export type TextInputAndroidProps = $ReadOnly<{ textBreakStrategy?: ?(\\"simple\\" | \\"highQuality\\" | \\"balanced\\"), underlineColorAndroid?: ?ColorValue, }>; -export type TextInputProps = $ReadOnly<{ - ...$Diff>, - ...TextInputIOSProps, - ...TextInputAndroidProps, - autoCapitalize?: ?AutoCapitalize, - autoComplete?: ?( - | \\"additional-name\\" - | \\"address-line1\\" - | \\"address-line2\\" - | \\"birthdate-day\\" - | \\"birthdate-full\\" - | \\"birthdate-month\\" - | \\"birthdate-year\\" - | \\"cc-csc\\" - | \\"cc-exp\\" - | \\"cc-exp-day\\" - | \\"cc-exp-month\\" - | \\"cc-exp-year\\" - | \\"cc-number\\" - | \\"cc-name\\" - | \\"cc-given-name\\" - | \\"cc-middle-name\\" - | \\"cc-family-name\\" - | \\"cc-type\\" - | \\"country\\" - | \\"current-password\\" - | \\"email\\" - | \\"family-name\\" - | \\"gender\\" - | \\"given-name\\" - | \\"honorific-prefix\\" - | \\"honorific-suffix\\" - | \\"name\\" - | \\"name-family\\" - | \\"name-given\\" - | \\"name-middle\\" - | \\"name-middle-initial\\" - | \\"name-prefix\\" - | \\"name-suffix\\" - | \\"new-password\\" - | \\"nickname\\" - | \\"one-time-code\\" - | \\"organization\\" - | \\"organization-title\\" - | \\"password\\" - | \\"password-new\\" - | \\"postal-address\\" - | \\"postal-address-country\\" - | \\"postal-address-extended\\" - | \\"postal-address-extended-postal-code\\" - | \\"postal-address-locality\\" - | \\"postal-address-region\\" - | \\"postal-code\\" - | \\"street-address\\" - | \\"sms-otp\\" - | \\"tel\\" - | \\"tel-country-code\\" - | \\"tel-national\\" - | \\"tel-device\\" - | \\"url\\" - | \\"username\\" - | \\"username-new\\" - | \\"off\\" - ), - autoCorrect?: ?boolean, - autoFocus?: ?boolean, - allowFontScaling?: ?boolean, - caretHidden?: ?boolean, - contextMenuHidden?: ?boolean, - defaultValue?: ?Stringish, - editable?: ?boolean, - forwardedRef?: ?React.RefSetter, - enterKeyHint?: ?EnterKeyHintTypeOptions, - inputMode?: ?InputModeOptions, - keyboardType?: ?KeyboardTypeOptions, - maxFontSizeMultiplier?: ?number, - maxLength?: ?number, - multiline?: ?boolean, - onBlur?: ?(e: TextInputBlurEvent) => mixed, - onChange?: ?(e: TextInputChangeEvent) => mixed, - unstable_onChangeSync?: ?(e: TextInputChangeEvent) => mixed, - onChangeText?: ?(text: string) => mixed, - unstable_onChangeTextSync?: ?(text: string) => mixed, - onContentSizeChange?: ?(e: TextInputContentSizeChangeEvent) => mixed, - onEndEditing?: ?(e: TextInputEndEditingEvent) => mixed, - onFocus?: ?(e: TextInputFocusEvent) => mixed, - onKeyPress?: ?(e: TextInputKeyPressEvent) => mixed, - unstable_onKeyPressSync?: ?(e: TextInputKeyPressEvent) => mixed, - onPress?: ?(event: GestureResponderEvent) => mixed, - onPressIn?: ?(event: GestureResponderEvent) => mixed, - onPressOut?: ?(event: GestureResponderEvent) => mixed, - onSelectionChange?: ?(e: TextInputSelectionChangeEvent) => mixed, - onSubmitEditing?: ?(e: TextInputSubmitEditingEvent) => mixed, - onScroll?: ?(e: ScrollEvent) => mixed, - placeholder?: ?Stringish, - placeholderTextColor?: ?ColorValue, - readOnly?: ?boolean, - returnKeyType?: ?ReturnKeyTypeOptions, - secureTextEntry?: ?boolean, - selection?: ?$ReadOnly<{ - start: number, - end?: ?number, - }>, - selectionColor?: ?ColorValue, - selectTextOnFocus?: ?boolean, - blurOnSubmit?: ?boolean, - submitBehavior?: ?SubmitBehavior, - style?: ?TextStyleProp, - value?: ?Stringish, -}>; -export interface TextInputInstance extends HostInstance { - +clear: () => void; - +isFocused: () => boolean; - +getNativeRef: () => ?HostInstance; - +setSelection: (start: number, end: number) => void; -} -type InternalTextInput = component( - ref?: React.RefSetter, - ...TextInputProps -); -export type TextInputComponentStatics = $ReadOnly<{ - State: $ReadOnly<{ - currentlyFocusedInput: () => ?HostInstance, - currentlyFocusedField: () => ?number, - focusTextInput: (textField: ?HostInstance) => void, - blurTextInput: (textField: ?HostInstance) => void, - }>, -}>; -export type TextInputType = InternalTextInput & TextInputComponentStatics; -" -`; - -exports[`public API should not change unintentionally Libraries/Components/TextInput/TextInput.js 1`] = ` -"type TextInputChangeEventData = $ReadOnly<{ - eventCount: number, - target: number, - text: string, -}>; -export type TextInputChangeEvent = - NativeSyntheticEvent; -export type TextInputEvent = NativeSyntheticEvent< - $ReadOnly<{ - eventCount: number, - previousText: string, - range: $ReadOnly<{ - start: number, - end: number, - }>, - target: number, - text: string, - }>, ->; -type TextInputContentSizeChangeEventData = $ReadOnly<{ - target: number, - contentSize: $ReadOnly<{ - width: number, - height: number, - }>, -}>; -export type TextInputContentSizeChangeEvent = - NativeSyntheticEvent; -export type TargetEvent = $ReadOnly<{ - target: number, -}>; -type TextInputFocusEventData = TargetEvent; -export type TextInputBlurEvent = NativeSyntheticEvent; -export type TextInputFocusEvent = NativeSyntheticEvent; -type TextInputScrollEventData = { - contentOffset: { x: number, y: number }, -}; -export type TextInputScrollEvent = - NativeSyntheticEvent; -type Selection = $ReadOnly<{ - start: number, - end: number, -}>; -type TextInputSelectionChangeEventData = $ReadOnly<{ - ...TargetEvent, - selection: Selection, -}>; -export type TextInputSelectionChangeEvent = - NativeSyntheticEvent; -type TextInputKeyPressEventData = $ReadOnly<{ - ...TargetEvent, - key: string, - target?: ?number, - eventCount?: ?number, -}>; -export type TextInputKeyPressEvent = - NativeSyntheticEvent; -type TextInputEndEditingEventData = $ReadOnly<{ - ...TargetEvent, - eventCount: number, - text: string, -}>; -export type TextInputEndEditingEvent = - NativeSyntheticEvent; -type TextInputSubmitEditingEventData = $ReadOnly<{ - ...TargetEvent, - eventCount: number, - text: string, -}>; -export type TextInputSubmitEditingEvent = - NativeSyntheticEvent; -export type TextInputEditingEvent = - NativeSyntheticEvent; -type DataDetectorTypesType = - | \\"phoneNumber\\" - | \\"link\\" - | \\"address\\" - | \\"calendarEvent\\" - | \\"trackingNumber\\" - | \\"flightNumber\\" - | \\"lookupSuggestion\\" - | \\"none\\" - | \\"all\\"; -export type KeyboardType = - | \\"default\\" - | \\"email-address\\" - | \\"numeric\\" - | \\"phone-pad\\" - | \\"number-pad\\" - | \\"decimal-pad\\" - | \\"url\\"; -export type KeyboardTypeIOS = - | \\"ascii-capable\\" - | \\"numbers-and-punctuation\\" - | \\"name-phone-pad\\" - | \\"twitter\\" - | \\"web-search\\" - | \\"ascii-capable-number-pad\\"; -export type KeyboardTypeAndroid = \\"visible-password\\"; -export type KeyboardTypeOptions = - | KeyboardType - | KeyboardTypeIOS - | KeyboardTypeAndroid; -export type InputModeOptions = - | \\"none\\" - | \\"text\\" - | \\"decimal\\" - | \\"numeric\\" - | \\"tel\\" - | \\"search\\" - | \\"email\\" - | \\"url\\"; -export type ReturnKeyType = \\"done\\" | \\"go\\" | \\"next\\" | \\"search\\" | \\"send\\"; -export type ReturnKeyTypeIOS = - | \\"default\\" - | \\"emergency-call\\" - | \\"google\\" - | \\"join\\" - | \\"route\\" - | \\"yahoo\\"; -export type ReturnKeyTypeAndroid = \\"none\\" | \\"previous\\"; -export type ReturnKeyTypeOptions = - | ReturnKeyType - | ReturnKeyTypeIOS - | ReturnKeyTypeAndroid; -export type SubmitBehavior = \\"submit\\" | \\"blurAndSubmit\\" | \\"newline\\"; -export type AutoCapitalize = \\"none\\" | \\"sentences\\" | \\"words\\" | \\"characters\\"; -export type TextContentType = - | \\"none\\" - | \\"URL\\" - | \\"addressCity\\" - | \\"addressCityAndState\\" - | \\"addressState\\" - | \\"countryName\\" - | \\"creditCardNumber\\" - | \\"creditCardExpiration\\" - | \\"creditCardExpirationMonth\\" - | \\"creditCardExpirationYear\\" - | \\"creditCardSecurityCode\\" - | \\"creditCardType\\" - | \\"creditCardName\\" - | \\"creditCardGivenName\\" - | \\"creditCardMiddleName\\" - | \\"creditCardFamilyName\\" - | \\"emailAddress\\" - | \\"familyName\\" - | \\"fullStreetAddress\\" - | \\"givenName\\" - | \\"jobTitle\\" - | \\"location\\" - | \\"middleName\\" - | \\"name\\" - | \\"namePrefix\\" - | \\"nameSuffix\\" - | \\"nickname\\" - | \\"organizationName\\" - | \\"postalCode\\" - | \\"streetAddressLine1\\" - | \\"streetAddressLine2\\" - | \\"sublocality\\" - | \\"telephoneNumber\\" - | \\"username\\" - | \\"password\\" - | \\"newPassword\\" - | \\"oneTimeCode\\" - | \\"birthdate\\" - | \\"birthdateDay\\" - | \\"birthdateMonth\\" - | \\"birthdateYear\\" - | \\"cellularEID\\" - | \\"cellularIMEI\\" - | \\"dateTime\\" - | \\"flightNumber\\" - | \\"shipmentTrackingNumber\\"; -export type EnterKeyHintTypeAndroid = \\"previous\\"; -export type EnterKeyHintTypeIOS = \\"enter\\"; -export type EnterKeyHintType = \\"done\\" | \\"go\\" | \\"next\\" | \\"search\\" | \\"send\\"; -export type EnterKeyHintTypeOptions = - | EnterKeyHintType - | EnterKeyHintTypeAndroid - | EnterKeyHintTypeIOS; -type PasswordRules = string; -export type TextInputIOSProps = $ReadOnly<{ - disableKeyboardShortcuts?: ?boolean, - clearButtonMode?: ?(\\"never\\" | \\"while-editing\\" | \\"unless-editing\\" | \\"always\\"), - clearTextOnFocus?: ?boolean, - dataDetectorTypes?: - | ?DataDetectorTypesType - | $ReadOnlyArray, - enablesReturnKeyAutomatically?: ?boolean, - inputAccessoryViewID?: ?string, - inputAccessoryViewButtonLabel?: ?string, - keyboardAppearance?: ?(\\"default\\" | \\"light\\" | \\"dark\\"), - passwordRules?: ?PasswordRules, - rejectResponderTermination?: ?boolean, - scrollEnabled?: ?boolean, - spellCheck?: ?boolean, - textContentType?: ?TextContentType, - lineBreakStrategyIOS?: ?(\\"none\\" | \\"standard\\" | \\"hangul-word\\" | \\"push-out\\"), - lineBreakModeIOS?: ?( - | \\"wordWrapping\\" - | \\"char\\" - | \\"clip\\" - | \\"head\\" - | \\"middle\\" - | \\"tail\\" - ), - smartInsertDelete?: ?boolean, -}>; -export type TextInputAndroidProps = $ReadOnly<{ - cursorColor?: ?ColorValue, - disableFullscreenUI?: ?boolean, - importantForAutofill?: ?( - | \\"auto\\" - | \\"no\\" - | \\"noExcludeDescendants\\" - | \\"yes\\" - | \\"yesExcludeDescendants\\" - ), - inlineImageLeft?: ?string, - inlineImagePadding?: ?number, - numberOfLines?: ?number, - returnKeyLabel?: ?string, - rows?: ?number, - showSoftInputOnFocus?: ?boolean, - textBreakStrategy?: ?(\\"simple\\" | \\"highQuality\\" | \\"balanced\\"), - underlineColorAndroid?: ?ColorValue, -}>; type TextInputBaseProps = $ReadOnly<{ autoCapitalize?: ?AutoCapitalize, autoComplete?: ?( @@ -3336,7 +2981,6 @@ type TextInputBaseProps = $ReadOnly<{ end?: ?number, }>, selectionColor?: ?ColorValue, - selectionHandleColor?: ?ColorValue, selectTextOnFocus?: ?boolean, blurOnSubmit?: ?boolean, submitBehavior?: ?SubmitBehavior, @@ -3349,6 +2993,60 @@ export type TextInputProps = $ReadOnly<{ ...TextInputAndroidProps, ...TextInputBaseProps, }>; +export interface TextInputInstance extends HostInstance { + +clear: () => void; + +isFocused: () => boolean; + +getNativeRef: () => ?HostInstance; + +setSelection: (start: number, end: number) => void; +} +type InternalTextInput = component( + ref?: React.RefSetter, + ...TextInputProps +); +export type TextInputComponentStatics = $ReadOnly<{ + State: $ReadOnly<{ + currentlyFocusedInput: () => ?HostInstance, + currentlyFocusedField: () => ?number, + focusTextInput: (textField: ?HostInstance) => void, + blurTextInput: (textField: ?HostInstance) => void, + }>, +}>; +export type TextInputType = InternalTextInput & TextInputComponentStatics; +" +`; + +exports[`public API should not change unintentionally Libraries/Components/TextInput/TextInput.js 1`] = ` +"export type { + AutoCapitalize, + EnterKeyHintType, + EnterKeyHintTypeAndroid, + EnterKeyHintTypeIOS, + EnterKeyHintTypeOptions, + InputModeOptions, + KeyboardType, + KeyboardTypeAndroid, + KeyboardTypeIOS, + KeyboardTypeOptions, + ReturnKeyType, + ReturnKeyTypeAndroid, + ReturnKeyTypeIOS, + ReturnKeyTypeOptions, + SubmitBehavior, + TextContentType, + TextInputAndroidProps, + TextInputBlurEvent, + TextInputChangeEvent, + TextInputContentSizeChangeEvent, + TextInputEditingEvent, + TextInputEndEditingEvent, + TextInputEvent, + TextInputFocusEvent, + TextInputIOSProps, + TextInputKeyPressEvent, + TextInputProps, + TextInputSelectionChangeEvent, + TextInputSubmitEditingEvent, +}; type TextInputStateType = $ReadOnly<{ currentlyFocusedField: () => ?number, currentlyFocusedInput: () => ?HostInstance, @@ -9464,7 +9162,6 @@ export type { TextInputEndEditingEvent, TextInputFocusEvent, TextInputKeyPressEvent, - TextInputScrollEvent, TextInputSelectionChangeEvent, TextInputSubmitEditingEvent, ReturnKeyTypeOptions, diff --git a/packages/react-native/index.js.flow b/packages/react-native/index.js.flow index 6d99c403495..552507582ab 100644 --- a/packages/react-native/index.js.flow +++ b/packages/react-native/index.js.flow @@ -134,7 +134,6 @@ export type { TextInputEndEditingEvent, TextInputFocusEvent, TextInputKeyPressEvent, - TextInputScrollEvent, TextInputSelectionChangeEvent, TextInputSubmitEditingEvent, ReturnKeyTypeOptions,