1*fe5cfb17STomasz Sapeta/** 2*fe5cfb17STomasz Sapeta * Copyright (c) Meta Platforms, Inc. and affiliates. 3*fe5cfb17STomasz Sapeta * 4*fe5cfb17STomasz Sapeta * This source code is licensed under the MIT license found in the 5*fe5cfb17STomasz Sapeta * LICENSE file in the root directory of this source tree. 6*fe5cfb17STomasz Sapeta * 7*fe5cfb17STomasz Sapeta * @format 8*fe5cfb17STomasz Sapeta */ 9*fe5cfb17STomasz Sapeta 10*fe5cfb17STomasz Sapetaimport type * as React from 'react'; 11*fe5cfb17STomasz Sapetaimport {Constructor} from '../../../types/private/Utilities'; 12*fe5cfb17STomasz Sapetaimport {TimerMixin} from '../../../types/private/TimerMixin'; 13*fe5cfb17STomasz Sapetaimport { 14*fe5cfb17STomasz Sapeta HostComponent, 15*fe5cfb17STomasz Sapeta NativeMethods, 16*fe5cfb17STomasz Sapeta} from '../../../types/public/ReactNativeTypes'; 17*fe5cfb17STomasz Sapetaimport {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet'; 18*fe5cfb17STomasz Sapetaimport {TextStyle} from '../../StyleSheet/StyleSheetTypes'; 19*fe5cfb17STomasz Sapetaimport { 20*fe5cfb17STomasz Sapeta NativeSyntheticEvent, 21*fe5cfb17STomasz Sapeta NativeTouchEvent, 22*fe5cfb17STomasz Sapeta TargetedEvent, 23*fe5cfb17STomasz Sapeta} from '../../Types/CoreEventTypes'; 24*fe5cfb17STomasz Sapetaimport {EventEmitter} from '../../vendor/emitter/EventEmitter'; 25*fe5cfb17STomasz Sapetaimport {AccessibilityProps} from '../View/ViewAccessibility'; 26*fe5cfb17STomasz Sapetaimport {ViewProps} from '../View/ViewPropTypes'; 27*fe5cfb17STomasz Sapeta 28*fe5cfb17STomasz Sapetaexport type KeyboardType = 29*fe5cfb17STomasz Sapeta | 'default' 30*fe5cfb17STomasz Sapeta | 'email-address' 31*fe5cfb17STomasz Sapeta | 'numeric' 32*fe5cfb17STomasz Sapeta | 'phone-pad' 33*fe5cfb17STomasz Sapeta | 'number-pad' 34*fe5cfb17STomasz Sapeta | 'decimal-pad'; 35*fe5cfb17STomasz Sapetaexport type KeyboardTypeIOS = 36*fe5cfb17STomasz Sapeta | 'ascii-capable' 37*fe5cfb17STomasz Sapeta | 'numbers-and-punctuation' 38*fe5cfb17STomasz Sapeta | 'url' 39*fe5cfb17STomasz Sapeta | 'name-phone-pad' 40*fe5cfb17STomasz Sapeta | 'twitter' 41*fe5cfb17STomasz Sapeta | 'web-search'; 42*fe5cfb17STomasz Sapetaexport type KeyboardTypeAndroid = 'visible-password'; 43*fe5cfb17STomasz Sapetaexport type KeyboardTypeOptions = 44*fe5cfb17STomasz Sapeta | KeyboardType 45*fe5cfb17STomasz Sapeta | KeyboardTypeAndroid 46*fe5cfb17STomasz Sapeta | KeyboardTypeIOS; 47*fe5cfb17STomasz Sapeta 48*fe5cfb17STomasz Sapetaexport type InputModeOptions = 49*fe5cfb17STomasz Sapeta | 'none' 50*fe5cfb17STomasz Sapeta | 'text' 51*fe5cfb17STomasz Sapeta | 'decimal' 52*fe5cfb17STomasz Sapeta | 'numeric' 53*fe5cfb17STomasz Sapeta | 'tel' 54*fe5cfb17STomasz Sapeta | 'search' 55*fe5cfb17STomasz Sapeta | 'email' 56*fe5cfb17STomasz Sapeta | 'url'; 57*fe5cfb17STomasz Sapeta 58*fe5cfb17STomasz Sapetaexport type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send'; 59*fe5cfb17STomasz Sapetaexport type ReturnKeyTypeAndroid = 'none' | 'previous'; 60*fe5cfb17STomasz Sapetaexport type ReturnKeyTypeIOS = 61*fe5cfb17STomasz Sapeta | 'default' 62*fe5cfb17STomasz Sapeta | 'google' 63*fe5cfb17STomasz Sapeta | 'join' 64*fe5cfb17STomasz Sapeta | 'route' 65*fe5cfb17STomasz Sapeta | 'yahoo' 66*fe5cfb17STomasz Sapeta | 'emergency-call'; 67*fe5cfb17STomasz Sapeta 68*fe5cfb17STomasz Sapetaexport type ReturnKeyTypeOptions = 69*fe5cfb17STomasz Sapeta | ReturnKeyType 70*fe5cfb17STomasz Sapeta | ReturnKeyTypeAndroid 71*fe5cfb17STomasz Sapeta | ReturnKeyTypeIOS; 72*fe5cfb17STomasz Sapeta 73*fe5cfb17STomasz Sapetatype DataDetectorTypes = 74*fe5cfb17STomasz Sapeta | 'phoneNumber' 75*fe5cfb17STomasz Sapeta | 'link' 76*fe5cfb17STomasz Sapeta | 'address' 77*fe5cfb17STomasz Sapeta | 'calendarEvent' 78*fe5cfb17STomasz Sapeta | 'none' 79*fe5cfb17STomasz Sapeta | 'all'; 80*fe5cfb17STomasz Sapeta 81*fe5cfb17STomasz Sapeta/** 82*fe5cfb17STomasz Sapeta * DocumentSelectionState is responsible for maintaining selection information 83*fe5cfb17STomasz Sapeta * for a document. 84*fe5cfb17STomasz Sapeta * 85*fe5cfb17STomasz Sapeta * It is intended for use by AbstractTextEditor-based components for 86*fe5cfb17STomasz Sapeta * identifying the appropriate start/end positions to modify the 87*fe5cfb17STomasz Sapeta * DocumentContent, and for programmatically setting browser selection when 88*fe5cfb17STomasz Sapeta * components re-render. 89*fe5cfb17STomasz Sapeta */ 90*fe5cfb17STomasz Sapetaexport interface DocumentSelectionState extends EventEmitter { 91*fe5cfb17STomasz Sapeta new (anchor: number, focus: number): DocumentSelectionState; 92*fe5cfb17STomasz Sapeta 93*fe5cfb17STomasz Sapeta /** 94*fe5cfb17STomasz Sapeta * Apply an update to the state. If either offset value has changed, 95*fe5cfb17STomasz Sapeta * set the values and emit the `change` event. Otherwise no-op. 96*fe5cfb17STomasz Sapeta * 97*fe5cfb17STomasz Sapeta */ 98*fe5cfb17STomasz Sapeta update(anchor: number, focus: number): void; 99*fe5cfb17STomasz Sapeta 100*fe5cfb17STomasz Sapeta /** 101*fe5cfb17STomasz Sapeta * Given a max text length, constrain our selection offsets to ensure 102*fe5cfb17STomasz Sapeta * that the selection remains strictly within the text range. 103*fe5cfb17STomasz Sapeta * 104*fe5cfb17STomasz Sapeta */ 105*fe5cfb17STomasz Sapeta constrainLength(maxLength: number): void; 106*fe5cfb17STomasz Sapeta 107*fe5cfb17STomasz Sapeta focus(): void; 108*fe5cfb17STomasz Sapeta blur(): void; 109*fe5cfb17STomasz Sapeta hasFocus(): boolean; 110*fe5cfb17STomasz Sapeta isCollapsed(): boolean; 111*fe5cfb17STomasz Sapeta isBackward(): boolean; 112*fe5cfb17STomasz Sapeta 113*fe5cfb17STomasz Sapeta getAnchorOffset(): number; 114*fe5cfb17STomasz Sapeta getFocusOffset(): number; 115*fe5cfb17STomasz Sapeta getStartOffset(): number; 116*fe5cfb17STomasz Sapeta getEndOffset(): number; 117*fe5cfb17STomasz Sapeta overlaps(start: number, end: number): boolean; 118*fe5cfb17STomasz Sapeta} 119*fe5cfb17STomasz Sapeta 120*fe5cfb17STomasz Sapeta/** 121*fe5cfb17STomasz Sapeta * IOS Specific properties for TextInput 122*fe5cfb17STomasz Sapeta * @see https://reactnative.dev/docs/textinput#props 123*fe5cfb17STomasz Sapeta */ 124*fe5cfb17STomasz Sapetaexport interface TextInputIOSProps { 125*fe5cfb17STomasz Sapeta /** 126*fe5cfb17STomasz Sapeta * enum('never', 'while-editing', 'unless-editing', 'always') 127*fe5cfb17STomasz Sapeta * When the clear button should appear on the right side of the text view 128*fe5cfb17STomasz Sapeta */ 129*fe5cfb17STomasz Sapeta clearButtonMode?: 130*fe5cfb17STomasz Sapeta | 'never' 131*fe5cfb17STomasz Sapeta | 'while-editing' 132*fe5cfb17STomasz Sapeta | 'unless-editing' 133*fe5cfb17STomasz Sapeta | 'always' 134*fe5cfb17STomasz Sapeta | undefined; 135*fe5cfb17STomasz Sapeta 136*fe5cfb17STomasz Sapeta /** 137*fe5cfb17STomasz Sapeta * If true, clears the text field automatically when editing begins 138*fe5cfb17STomasz Sapeta */ 139*fe5cfb17STomasz Sapeta clearTextOnFocus?: boolean | undefined; 140*fe5cfb17STomasz Sapeta 141*fe5cfb17STomasz Sapeta /** 142*fe5cfb17STomasz Sapeta * Determines the types of data converted to clickable URLs in the text input. 143*fe5cfb17STomasz Sapeta * Only valid if `multiline={true}` and `editable={false}`. 144*fe5cfb17STomasz Sapeta * By default no data types are detected. 145*fe5cfb17STomasz Sapeta * 146*fe5cfb17STomasz Sapeta * You can provide one type or an array of many types. 147*fe5cfb17STomasz Sapeta * 148*fe5cfb17STomasz Sapeta * Possible values for `dataDetectorTypes` are: 149*fe5cfb17STomasz Sapeta * 150*fe5cfb17STomasz Sapeta * - `'phoneNumber'` 151*fe5cfb17STomasz Sapeta * - `'link'` 152*fe5cfb17STomasz Sapeta * - `'address'` 153*fe5cfb17STomasz Sapeta * - `'calendarEvent'` 154*fe5cfb17STomasz Sapeta * - `'none'` 155*fe5cfb17STomasz Sapeta * - `'all'` 156*fe5cfb17STomasz Sapeta */ 157*fe5cfb17STomasz Sapeta dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[] | undefined; 158*fe5cfb17STomasz Sapeta 159*fe5cfb17STomasz Sapeta /** 160*fe5cfb17STomasz Sapeta * If true, the keyboard disables the return key when there is no text and automatically enables it when there is text. 161*fe5cfb17STomasz Sapeta * The default value is false. 162*fe5cfb17STomasz Sapeta */ 163*fe5cfb17STomasz Sapeta enablesReturnKeyAutomatically?: boolean | undefined; 164*fe5cfb17STomasz Sapeta 165*fe5cfb17STomasz Sapeta /** 166*fe5cfb17STomasz Sapeta * Determines the color of the keyboard. 167*fe5cfb17STomasz Sapeta */ 168*fe5cfb17STomasz Sapeta keyboardAppearance?: 'default' | 'light' | 'dark' | undefined; 169*fe5cfb17STomasz Sapeta 170*fe5cfb17STomasz Sapeta /** 171*fe5cfb17STomasz Sapeta * Provide rules for your password. 172*fe5cfb17STomasz Sapeta * 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. 173*fe5cfb17STomasz Sapeta * "required: upper; required: lower; required: digit; max-consecutive: 2; minlength: 8;" 174*fe5cfb17STomasz Sapeta */ 175*fe5cfb17STomasz Sapeta passwordRules?: string | null | undefined; 176*fe5cfb17STomasz Sapeta 177*fe5cfb17STomasz Sapeta /** 178*fe5cfb17STomasz Sapeta * If `true`, allows TextInput to pass touch events to the parent component. 179*fe5cfb17STomasz Sapeta * This allows components to be swipeable from the TextInput on iOS, 180*fe5cfb17STomasz Sapeta * as is the case on Android by default. 181*fe5cfb17STomasz Sapeta * If `false`, TextInput always asks to handle the input (except when disabled). 182*fe5cfb17STomasz Sapeta */ 183*fe5cfb17STomasz Sapeta rejectResponderTermination?: boolean | null | undefined; 184*fe5cfb17STomasz Sapeta 185*fe5cfb17STomasz Sapeta /** 186*fe5cfb17STomasz Sapeta * See DocumentSelectionState.js, some state that is responsible for maintaining selection information for a document 187*fe5cfb17STomasz Sapeta */ 188*fe5cfb17STomasz Sapeta selectionState?: DocumentSelectionState | undefined; 189*fe5cfb17STomasz Sapeta 190*fe5cfb17STomasz Sapeta /** 191*fe5cfb17STomasz Sapeta * If false, disables spell-check style (i.e. red underlines). The default value is inherited from autoCorrect 192*fe5cfb17STomasz Sapeta */ 193*fe5cfb17STomasz Sapeta spellCheck?: boolean | undefined; 194*fe5cfb17STomasz Sapeta 195*fe5cfb17STomasz Sapeta /** 196*fe5cfb17STomasz Sapeta * Give the keyboard and the system information about the expected 197*fe5cfb17STomasz Sapeta * semantic meaning for the content that users enter. 198*fe5cfb17STomasz Sapeta * 199*fe5cfb17STomasz Sapeta * For iOS 11+ you can set `textContentType` to `username` or `password` to 200*fe5cfb17STomasz Sapeta * enable autofill of login details from the device keychain. 201*fe5cfb17STomasz Sapeta * 202*fe5cfb17STomasz Sapeta * For iOS 12+ `newPassword` can be used to indicate a new password input the 203*fe5cfb17STomasz Sapeta * user may want to save in the keychain, and `oneTimeCode` can be used to indicate 204*fe5cfb17STomasz Sapeta * that a field can be autofilled by a code arriving in an SMS. 205*fe5cfb17STomasz Sapeta * 206*fe5cfb17STomasz Sapeta * To disable autofill, set textContentType to `none`. 207*fe5cfb17STomasz Sapeta * 208*fe5cfb17STomasz Sapeta * Possible values for `textContentType` are: 209*fe5cfb17STomasz Sapeta * 210*fe5cfb17STomasz Sapeta * - `'none'` 211*fe5cfb17STomasz Sapeta * - `'URL'` 212*fe5cfb17STomasz Sapeta * - `'addressCity'` 213*fe5cfb17STomasz Sapeta * - `'addressCityAndState'` 214*fe5cfb17STomasz Sapeta * - `'addressState'` 215*fe5cfb17STomasz Sapeta * - `'countryName'` 216*fe5cfb17STomasz Sapeta * - `'creditCardNumber'` 217*fe5cfb17STomasz Sapeta * - `'emailAddress'` 218*fe5cfb17STomasz Sapeta * - `'familyName'` 219*fe5cfb17STomasz Sapeta * - `'fullStreetAddress'` 220*fe5cfb17STomasz Sapeta * - `'givenName'` 221*fe5cfb17STomasz Sapeta * - `'jobTitle'` 222*fe5cfb17STomasz Sapeta * - `'location'` 223*fe5cfb17STomasz Sapeta * - `'middleName'` 224*fe5cfb17STomasz Sapeta * - `'name'` 225*fe5cfb17STomasz Sapeta * - `'namePrefix'` 226*fe5cfb17STomasz Sapeta * - `'nameSuffix'` 227*fe5cfb17STomasz Sapeta * - `'nickname'` 228*fe5cfb17STomasz Sapeta * - `'organizationName'` 229*fe5cfb17STomasz Sapeta * - `'postalCode'` 230*fe5cfb17STomasz Sapeta * - `'streetAddressLine1'` 231*fe5cfb17STomasz Sapeta * - `'streetAddressLine2'` 232*fe5cfb17STomasz Sapeta * - `'sublocality'` 233*fe5cfb17STomasz Sapeta * - `'telephoneNumber'` 234*fe5cfb17STomasz Sapeta * - `'username'` 235*fe5cfb17STomasz Sapeta * - `'password'` 236*fe5cfb17STomasz Sapeta * - `'newPassword'` 237*fe5cfb17STomasz Sapeta * - `'oneTimeCode'` 238*fe5cfb17STomasz Sapeta * 239*fe5cfb17STomasz Sapeta */ 240*fe5cfb17STomasz Sapeta textContentType?: 241*fe5cfb17STomasz Sapeta | 'none' 242*fe5cfb17STomasz Sapeta | 'URL' 243*fe5cfb17STomasz Sapeta | 'addressCity' 244*fe5cfb17STomasz Sapeta | 'addressCityAndState' 245*fe5cfb17STomasz Sapeta | 'addressState' 246*fe5cfb17STomasz Sapeta | 'countryName' 247*fe5cfb17STomasz Sapeta | 'creditCardNumber' 248*fe5cfb17STomasz Sapeta | 'emailAddress' 249*fe5cfb17STomasz Sapeta | 'familyName' 250*fe5cfb17STomasz Sapeta | 'fullStreetAddress' 251*fe5cfb17STomasz Sapeta | 'givenName' 252*fe5cfb17STomasz Sapeta | 'jobTitle' 253*fe5cfb17STomasz Sapeta | 'location' 254*fe5cfb17STomasz Sapeta | 'middleName' 255*fe5cfb17STomasz Sapeta | 'name' 256*fe5cfb17STomasz Sapeta | 'namePrefix' 257*fe5cfb17STomasz Sapeta | 'nameSuffix' 258*fe5cfb17STomasz Sapeta | 'nickname' 259*fe5cfb17STomasz Sapeta | 'organizationName' 260*fe5cfb17STomasz Sapeta | 'postalCode' 261*fe5cfb17STomasz Sapeta | 'streetAddressLine1' 262*fe5cfb17STomasz Sapeta | 'streetAddressLine2' 263*fe5cfb17STomasz Sapeta | 'sublocality' 264*fe5cfb17STomasz Sapeta | 'telephoneNumber' 265*fe5cfb17STomasz Sapeta | 'username' 266*fe5cfb17STomasz Sapeta | 'password' 267*fe5cfb17STomasz Sapeta | 'newPassword' 268*fe5cfb17STomasz Sapeta | 'oneTimeCode' 269*fe5cfb17STomasz Sapeta | undefined; 270*fe5cfb17STomasz Sapeta 271*fe5cfb17STomasz Sapeta /** 272*fe5cfb17STomasz Sapeta * If false, scrolling of the text view will be disabled. The default value is true. Only works with multiline={true} 273*fe5cfb17STomasz Sapeta */ 274*fe5cfb17STomasz Sapeta scrollEnabled?: boolean | undefined; 275*fe5cfb17STomasz Sapeta} 276*fe5cfb17STomasz Sapeta 277*fe5cfb17STomasz Sapeta/** 278*fe5cfb17STomasz Sapeta * Android Specific properties for TextInput 279*fe5cfb17STomasz Sapeta * @see https://reactnative.dev/docs/textinput#props 280*fe5cfb17STomasz Sapeta */ 281*fe5cfb17STomasz Sapetaexport interface TextInputAndroidProps { 282*fe5cfb17STomasz Sapeta /** 283*fe5cfb17STomasz Sapeta * 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. 284*fe5cfb17STomasz Sapeta * To disable autocomplete, set `autoComplete` to `off`. 285*fe5cfb17STomasz Sapeta * 286*fe5cfb17STomasz Sapeta * *Android Only* 287*fe5cfb17STomasz Sapeta * 288*fe5cfb17STomasz Sapeta * Possible values for `autoComplete` are: 289*fe5cfb17STomasz Sapeta * 290*fe5cfb17STomasz Sapeta * - `birthdate-day` 291*fe5cfb17STomasz Sapeta * - `birthdate-full` 292*fe5cfb17STomasz Sapeta * - `birthdate-month` 293*fe5cfb17STomasz Sapeta * - `birthdate-year` 294*fe5cfb17STomasz Sapeta * - `cc-csc` 295*fe5cfb17STomasz Sapeta * - `cc-exp` 296*fe5cfb17STomasz Sapeta * - `cc-exp-day` 297*fe5cfb17STomasz Sapeta * - `cc-exp-month` 298*fe5cfb17STomasz Sapeta * - `cc-exp-year` 299*fe5cfb17STomasz Sapeta * - `cc-number` 300*fe5cfb17STomasz Sapeta * - `email` 301*fe5cfb17STomasz Sapeta * - `gender` 302*fe5cfb17STomasz Sapeta * - `name` 303*fe5cfb17STomasz Sapeta * - `name-family` 304*fe5cfb17STomasz Sapeta * - `name-given` 305*fe5cfb17STomasz Sapeta * - `name-middle` 306*fe5cfb17STomasz Sapeta * - `name-middle-initial` 307*fe5cfb17STomasz Sapeta * - `name-prefix` 308*fe5cfb17STomasz Sapeta * - `name-suffix` 309*fe5cfb17STomasz Sapeta * - `password` 310*fe5cfb17STomasz Sapeta * - `password-new` 311*fe5cfb17STomasz Sapeta * - `postal-address` 312*fe5cfb17STomasz Sapeta * - `postal-address-country` 313*fe5cfb17STomasz Sapeta * - `postal-address-extended` 314*fe5cfb17STomasz Sapeta * - `postal-address-extended-postal-code` 315*fe5cfb17STomasz Sapeta * - `postal-address-locality` 316*fe5cfb17STomasz Sapeta * - `postal-address-region` 317*fe5cfb17STomasz Sapeta * - `postal-code` 318*fe5cfb17STomasz Sapeta * - `street-address` 319*fe5cfb17STomasz Sapeta * - `sms-otp` 320*fe5cfb17STomasz Sapeta * - `tel` 321*fe5cfb17STomasz Sapeta * - `tel-country-code` 322*fe5cfb17STomasz Sapeta * - `tel-national` 323*fe5cfb17STomasz Sapeta * - `tel-device` 324*fe5cfb17STomasz Sapeta * - `username` 325*fe5cfb17STomasz Sapeta * - `username-new` 326*fe5cfb17STomasz Sapeta * - `off` 327*fe5cfb17STomasz Sapeta */ 328*fe5cfb17STomasz Sapeta autoComplete?: 329*fe5cfb17STomasz Sapeta | 'birthdate-day' 330*fe5cfb17STomasz Sapeta | 'birthdate-full' 331*fe5cfb17STomasz Sapeta | 'birthdate-month' 332*fe5cfb17STomasz Sapeta | 'birthdate-year' 333*fe5cfb17STomasz Sapeta | 'cc-csc' 334*fe5cfb17STomasz Sapeta | 'cc-exp' 335*fe5cfb17STomasz Sapeta | 'cc-exp-day' 336*fe5cfb17STomasz Sapeta | 'cc-exp-month' 337*fe5cfb17STomasz Sapeta | 'cc-exp-year' 338*fe5cfb17STomasz Sapeta | 'cc-number' 339*fe5cfb17STomasz Sapeta | 'email' 340*fe5cfb17STomasz Sapeta | 'gender' 341*fe5cfb17STomasz Sapeta | 'name' 342*fe5cfb17STomasz Sapeta | 'name-family' 343*fe5cfb17STomasz Sapeta | 'name-given' 344*fe5cfb17STomasz Sapeta | 'name-middle' 345*fe5cfb17STomasz Sapeta | 'name-middle-initial' 346*fe5cfb17STomasz Sapeta | 'name-prefix' 347*fe5cfb17STomasz Sapeta | 'name-suffix' 348*fe5cfb17STomasz Sapeta | 'password' 349*fe5cfb17STomasz Sapeta | 'password-new' 350*fe5cfb17STomasz Sapeta | 'postal-address' 351*fe5cfb17STomasz Sapeta | 'postal-address-country' 352*fe5cfb17STomasz Sapeta | 'postal-address-extended' 353*fe5cfb17STomasz Sapeta | 'postal-address-extended-postal-code' 354*fe5cfb17STomasz Sapeta | 'postal-address-locality' 355*fe5cfb17STomasz Sapeta | 'postal-address-region' 356*fe5cfb17STomasz Sapeta | 'postal-code' 357*fe5cfb17STomasz Sapeta | 'street-address' 358*fe5cfb17STomasz Sapeta | 'sms-otp' 359*fe5cfb17STomasz Sapeta | 'tel' 360*fe5cfb17STomasz Sapeta | 'tel-country-code' 361*fe5cfb17STomasz Sapeta | 'tel-national' 362*fe5cfb17STomasz Sapeta | 'tel-device' 363*fe5cfb17STomasz Sapeta | 'username' 364*fe5cfb17STomasz Sapeta | 'username-new' 365*fe5cfb17STomasz Sapeta | 'off' 366*fe5cfb17STomasz Sapeta | undefined; 367*fe5cfb17STomasz Sapeta 368*fe5cfb17STomasz Sapeta /** 369*fe5cfb17STomasz Sapeta * When provided it will set the color of the cursor (or "caret") in the component. 370*fe5cfb17STomasz Sapeta * Unlike the behavior of `selectionColor` the cursor color will be set independently 371*fe5cfb17STomasz Sapeta * from the color of the text selection box. 372*fe5cfb17STomasz Sapeta * @platform android 373*fe5cfb17STomasz Sapeta */ 374*fe5cfb17STomasz Sapeta cursorColor?: ColorValue | null | undefined; 375*fe5cfb17STomasz Sapeta 376*fe5cfb17STomasz Sapeta /** 377*fe5cfb17STomasz Sapeta * Determines whether the individual fields in your app should be included in a 378*fe5cfb17STomasz Sapeta * view structure for autofill purposes on Android API Level 26+. Defaults to auto. 379*fe5cfb17STomasz Sapeta * To disable auto complete, use `off`. 380*fe5cfb17STomasz Sapeta * 381*fe5cfb17STomasz Sapeta * *Android Only* 382*fe5cfb17STomasz Sapeta * 383*fe5cfb17STomasz Sapeta * The following values work on Android only: 384*fe5cfb17STomasz Sapeta * 385*fe5cfb17STomasz Sapeta * - `auto` - let Android decide 386*fe5cfb17STomasz Sapeta * - `no` - not important for autofill 387*fe5cfb17STomasz Sapeta * - `noExcludeDescendants` - this view and its children aren't important for autofill 388*fe5cfb17STomasz Sapeta * - `yes` - is important for autofill 389*fe5cfb17STomasz Sapeta * - `yesExcludeDescendants` - this view is important for autofill but its children aren't 390*fe5cfb17STomasz Sapeta */ 391*fe5cfb17STomasz Sapeta importantForAutofill?: 392*fe5cfb17STomasz Sapeta | 'auto' 393*fe5cfb17STomasz Sapeta | 'no' 394*fe5cfb17STomasz Sapeta | 'noExcludeDescendants' 395*fe5cfb17STomasz Sapeta | 'yes' 396*fe5cfb17STomasz Sapeta | 'yesExcludeDescendants' 397*fe5cfb17STomasz Sapeta | undefined; 398*fe5cfb17STomasz Sapeta 399*fe5cfb17STomasz Sapeta /** 400*fe5cfb17STomasz Sapeta * When false, if there is a small amount of space available around a text input (e.g. landscape orientation on a phone), 401*fe5cfb17STomasz Sapeta * the OS may choose to have the user edit the text inside of a full screen text input mode. 402*fe5cfb17STomasz Sapeta * When true, this feature is disabled and users will always edit the text directly inside of the text input. 403*fe5cfb17STomasz Sapeta * Defaults to false. 404*fe5cfb17STomasz Sapeta */ 405*fe5cfb17STomasz Sapeta disableFullscreenUI?: boolean | undefined; 406*fe5cfb17STomasz Sapeta 407*fe5cfb17STomasz Sapeta /** 408*fe5cfb17STomasz Sapeta * If defined, the provided image resource will be rendered on the left. 409*fe5cfb17STomasz Sapeta */ 410*fe5cfb17STomasz Sapeta inlineImageLeft?: string | undefined; 411*fe5cfb17STomasz Sapeta 412*fe5cfb17STomasz Sapeta /** 413*fe5cfb17STomasz Sapeta * Padding between the inline image, if any, and the text input itself. 414*fe5cfb17STomasz Sapeta */ 415*fe5cfb17STomasz Sapeta inlineImagePadding?: number | undefined; 416*fe5cfb17STomasz Sapeta 417*fe5cfb17STomasz Sapeta /** 418*fe5cfb17STomasz Sapeta * Sets the number of lines for a TextInput. 419*fe5cfb17STomasz Sapeta * Use it with multiline set to true to be able to fill the lines. 420*fe5cfb17STomasz Sapeta */ 421*fe5cfb17STomasz Sapeta numberOfLines?: number | undefined; 422*fe5cfb17STomasz Sapeta 423*fe5cfb17STomasz Sapeta /** 424*fe5cfb17STomasz Sapeta * Sets the return key to the label. Use it instead of `returnKeyType`. 425*fe5cfb17STomasz Sapeta * @platform android 426*fe5cfb17STomasz Sapeta */ 427*fe5cfb17STomasz Sapeta returnKeyLabel?: string | undefined; 428*fe5cfb17STomasz Sapeta 429*fe5cfb17STomasz Sapeta /** 430*fe5cfb17STomasz Sapeta * Set text break strategy on Android API Level 23+, possible values are simple, highQuality, balanced 431*fe5cfb17STomasz Sapeta * The default value is simple. 432*fe5cfb17STomasz Sapeta */ 433*fe5cfb17STomasz Sapeta textBreakStrategy?: 'simple' | 'highQuality' | 'balanced' | undefined; 434*fe5cfb17STomasz Sapeta 435*fe5cfb17STomasz Sapeta /** 436*fe5cfb17STomasz Sapeta * The color of the textInput underline. 437*fe5cfb17STomasz Sapeta */ 438*fe5cfb17STomasz Sapeta underlineColorAndroid?: ColorValue | undefined; 439*fe5cfb17STomasz Sapeta 440*fe5cfb17STomasz Sapeta /** 441*fe5cfb17STomasz Sapeta * Vertically align text when `multiline` is set to true 442*fe5cfb17STomasz Sapeta */ 443*fe5cfb17STomasz Sapeta textAlignVertical?: 'auto' | 'top' | 'bottom' | 'center' | undefined; 444*fe5cfb17STomasz Sapeta 445*fe5cfb17STomasz Sapeta /** 446*fe5cfb17STomasz Sapeta * When false, it will prevent the soft keyboard from showing when the field is focused. The default value is true 447*fe5cfb17STomasz Sapeta */ 448*fe5cfb17STomasz Sapeta showSoftInputOnFocus?: boolean | undefined; 449*fe5cfb17STomasz Sapeta 450*fe5cfb17STomasz Sapeta /** 451*fe5cfb17STomasz Sapeta * Vertically align text when `multiline` is set to true 452*fe5cfb17STomasz Sapeta */ 453*fe5cfb17STomasz Sapeta verticalAlign?: 'auto' | 'top' | 'bottom' | 'middle' | undefined; 454*fe5cfb17STomasz Sapeta} 455*fe5cfb17STomasz Sapeta 456*fe5cfb17STomasz Sapeta/** 457*fe5cfb17STomasz Sapeta * @see TextInputProps.onFocus 458*fe5cfb17STomasz Sapeta */ 459*fe5cfb17STomasz Sapetaexport interface TextInputFocusEventData extends TargetedEvent { 460*fe5cfb17STomasz Sapeta text: string; 461*fe5cfb17STomasz Sapeta eventCount: number; 462*fe5cfb17STomasz Sapeta} 463*fe5cfb17STomasz Sapeta 464*fe5cfb17STomasz Sapeta/** 465*fe5cfb17STomasz Sapeta * @see TextInputProps.onScroll 466*fe5cfb17STomasz Sapeta */ 467*fe5cfb17STomasz Sapetaexport interface TextInputScrollEventData { 468*fe5cfb17STomasz Sapeta contentOffset: {x: number; y: number}; 469*fe5cfb17STomasz Sapeta} 470*fe5cfb17STomasz Sapeta 471*fe5cfb17STomasz Sapeta/** 472*fe5cfb17STomasz Sapeta * @see TextInputProps.onSelectionChange 473*fe5cfb17STomasz Sapeta */ 474*fe5cfb17STomasz Sapetaexport interface TextInputSelectionChangeEventData extends TargetedEvent { 475*fe5cfb17STomasz Sapeta selection: { 476*fe5cfb17STomasz Sapeta start: number; 477*fe5cfb17STomasz Sapeta end: number; 478*fe5cfb17STomasz Sapeta }; 479*fe5cfb17STomasz Sapeta} 480*fe5cfb17STomasz Sapeta 481*fe5cfb17STomasz Sapeta/** 482*fe5cfb17STomasz Sapeta * @see TextInputProps.onKeyPress 483*fe5cfb17STomasz Sapeta */ 484*fe5cfb17STomasz Sapetaexport interface TextInputKeyPressEventData { 485*fe5cfb17STomasz Sapeta key: string; 486*fe5cfb17STomasz Sapeta} 487*fe5cfb17STomasz Sapeta 488*fe5cfb17STomasz Sapeta/** 489*fe5cfb17STomasz Sapeta * @see TextInputProps.onChange 490*fe5cfb17STomasz Sapeta */ 491*fe5cfb17STomasz Sapetaexport interface TextInputChangeEventData extends TargetedEvent { 492*fe5cfb17STomasz Sapeta eventCount: number; 493*fe5cfb17STomasz Sapeta text: string; 494*fe5cfb17STomasz Sapeta} 495*fe5cfb17STomasz Sapeta 496*fe5cfb17STomasz Sapeta/** 497*fe5cfb17STomasz Sapeta * @see TextInputProps.onContentSizeChange 498*fe5cfb17STomasz Sapeta */ 499*fe5cfb17STomasz Sapetaexport interface TextInputContentSizeChangeEventData { 500*fe5cfb17STomasz Sapeta contentSize: {width: number; height: number}; 501*fe5cfb17STomasz Sapeta} 502*fe5cfb17STomasz Sapeta 503*fe5cfb17STomasz Sapeta/** 504*fe5cfb17STomasz Sapeta * @see TextInputProps.onEndEditing 505*fe5cfb17STomasz Sapeta */ 506*fe5cfb17STomasz Sapetaexport interface TextInputEndEditingEventData { 507*fe5cfb17STomasz Sapeta text: string; 508*fe5cfb17STomasz Sapeta} 509*fe5cfb17STomasz Sapeta 510*fe5cfb17STomasz Sapeta/** 511*fe5cfb17STomasz Sapeta * @see TextInputProps.onSubmitEditing 512*fe5cfb17STomasz Sapeta */ 513*fe5cfb17STomasz Sapetaexport interface TextInputSubmitEditingEventData { 514*fe5cfb17STomasz Sapeta text: string; 515*fe5cfb17STomasz Sapeta} 516*fe5cfb17STomasz Sapeta 517*fe5cfb17STomasz Sapeta/** 518*fe5cfb17STomasz Sapeta * @see TextInputProps.onTextInput 519*fe5cfb17STomasz Sapeta */ 520*fe5cfb17STomasz Sapetaexport interface TextInputTextInputEventData { 521*fe5cfb17STomasz Sapeta text: string; 522*fe5cfb17STomasz Sapeta previousText: string; 523*fe5cfb17STomasz Sapeta range: {start: number; end: number}; 524*fe5cfb17STomasz Sapeta} 525*fe5cfb17STomasz Sapeta 526*fe5cfb17STomasz Sapeta/** 527*fe5cfb17STomasz Sapeta * @see https://reactnative.dev/docs/textinput#props 528*fe5cfb17STomasz Sapeta */ 529*fe5cfb17STomasz Sapetaexport interface TextInputProps 530*fe5cfb17STomasz Sapeta extends ViewProps, 531*fe5cfb17STomasz Sapeta TextInputIOSProps, 532*fe5cfb17STomasz Sapeta TextInputAndroidProps, 533*fe5cfb17STomasz Sapeta AccessibilityProps { 534*fe5cfb17STomasz Sapeta /** 535*fe5cfb17STomasz Sapeta * Specifies whether fonts should scale to respect Text Size accessibility settings. 536*fe5cfb17STomasz Sapeta * The default is `true`. 537*fe5cfb17STomasz Sapeta */ 538*fe5cfb17STomasz Sapeta allowFontScaling?: boolean | undefined; 539*fe5cfb17STomasz Sapeta 540*fe5cfb17STomasz Sapeta /** 541*fe5cfb17STomasz Sapeta * Can tell TextInput to automatically capitalize certain characters. 542*fe5cfb17STomasz Sapeta * characters: all characters, 543*fe5cfb17STomasz Sapeta * words: first letter of each word 544*fe5cfb17STomasz Sapeta * sentences: first letter of each sentence (default) 545*fe5cfb17STomasz Sapeta * none: don't auto capitalize anything 546*fe5cfb17STomasz Sapeta * 547*fe5cfb17STomasz Sapeta * https://reactnative.dev/docs/textinput#autocapitalize 548*fe5cfb17STomasz Sapeta */ 549*fe5cfb17STomasz Sapeta autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters' | undefined; 550*fe5cfb17STomasz Sapeta 551*fe5cfb17STomasz Sapeta /** 552*fe5cfb17STomasz Sapeta * If false, disables auto-correct. 553*fe5cfb17STomasz Sapeta * The default value is true. 554*fe5cfb17STomasz Sapeta */ 555*fe5cfb17STomasz Sapeta autoCorrect?: boolean | undefined; 556*fe5cfb17STomasz Sapeta 557*fe5cfb17STomasz Sapeta /** 558*fe5cfb17STomasz Sapeta * If true, focuses the input on componentDidMount. 559*fe5cfb17STomasz Sapeta * The default value is false. 560*fe5cfb17STomasz Sapeta */ 561*fe5cfb17STomasz Sapeta autoFocus?: boolean | undefined; 562*fe5cfb17STomasz Sapeta 563*fe5cfb17STomasz Sapeta /** 564*fe5cfb17STomasz Sapeta * If true, the text field will blur when submitted. 565*fe5cfb17STomasz Sapeta * The default value is true. 566*fe5cfb17STomasz Sapeta */ 567*fe5cfb17STomasz Sapeta blurOnSubmit?: boolean | undefined; 568*fe5cfb17STomasz Sapeta 569*fe5cfb17STomasz Sapeta /** 570*fe5cfb17STomasz Sapeta * If true, caret is hidden. The default value is false. 571*fe5cfb17STomasz Sapeta */ 572*fe5cfb17STomasz Sapeta caretHidden?: boolean | undefined; 573*fe5cfb17STomasz Sapeta 574*fe5cfb17STomasz Sapeta /** 575*fe5cfb17STomasz Sapeta * If true, context menu is hidden. The default value is false. 576*fe5cfb17STomasz Sapeta */ 577*fe5cfb17STomasz Sapeta contextMenuHidden?: boolean | undefined; 578*fe5cfb17STomasz Sapeta 579*fe5cfb17STomasz Sapeta /** 580*fe5cfb17STomasz Sapeta * Provides an initial value that will change when the user starts typing. 581*fe5cfb17STomasz Sapeta * Useful for simple use-cases where you don't want to deal with listening to events 582*fe5cfb17STomasz Sapeta * and updating the value prop to keep the controlled state in sync. 583*fe5cfb17STomasz Sapeta */ 584*fe5cfb17STomasz Sapeta defaultValue?: string | undefined; 585*fe5cfb17STomasz Sapeta 586*fe5cfb17STomasz Sapeta /** 587*fe5cfb17STomasz Sapeta * If false, text is not editable. The default value is true. 588*fe5cfb17STomasz Sapeta */ 589*fe5cfb17STomasz Sapeta editable?: boolean | undefined; 590*fe5cfb17STomasz Sapeta 591*fe5cfb17STomasz Sapeta /** 592*fe5cfb17STomasz Sapeta * enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad', 593*fe5cfb17STomasz Sapeta * 'decimal-pad', 'twitter', 'web-search', 'visible-password') 594*fe5cfb17STomasz Sapeta * Determines which keyboard to open, e.g.numeric. 595*fe5cfb17STomasz Sapeta * The following values work across platforms: - default - numeric - email-address - phone-pad 596*fe5cfb17STomasz Sapeta * The following values work on iOS: - ascii-capable - numbers-and-punctuation - url - number-pad - name-phone-pad - decimal-pad - twitter - web-search 597*fe5cfb17STomasz Sapeta * The following values work on Android: - visible-password 598*fe5cfb17STomasz Sapeta */ 599*fe5cfb17STomasz Sapeta keyboardType?: KeyboardTypeOptions | undefined; 600*fe5cfb17STomasz Sapeta 601*fe5cfb17STomasz Sapeta /** 602*fe5cfb17STomasz Sapeta * Works like the inputmode attribute in HTML, it determines which keyboard to open, e.g. numeric and has precedence over keyboardType. 603*fe5cfb17STomasz Sapeta */ 604*fe5cfb17STomasz Sapeta inputMode?: InputModeOptions | undefined; 605*fe5cfb17STomasz Sapeta 606*fe5cfb17STomasz Sapeta /** 607*fe5cfb17STomasz Sapeta * Limits the maximum number of characters that can be entered. 608*fe5cfb17STomasz Sapeta * Use this instead of implementing the logic in JS to avoid flicker. 609*fe5cfb17STomasz Sapeta */ 610*fe5cfb17STomasz Sapeta maxLength?: number | undefined; 611*fe5cfb17STomasz Sapeta 612*fe5cfb17STomasz Sapeta /** 613*fe5cfb17STomasz Sapeta * If true, the text input can be multiple lines. The default value is false. 614*fe5cfb17STomasz Sapeta */ 615*fe5cfb17STomasz Sapeta multiline?: boolean | undefined; 616*fe5cfb17STomasz Sapeta 617*fe5cfb17STomasz Sapeta /** 618*fe5cfb17STomasz Sapeta * Callback that is called when the text input is blurred 619*fe5cfb17STomasz Sapeta */ 620*fe5cfb17STomasz Sapeta onBlur?: 621*fe5cfb17STomasz Sapeta | ((e: NativeSyntheticEvent<TextInputFocusEventData>) => void) 622*fe5cfb17STomasz Sapeta | undefined; 623*fe5cfb17STomasz Sapeta 624*fe5cfb17STomasz Sapeta /** 625*fe5cfb17STomasz Sapeta * Callback that is called when the text input's text changes. 626*fe5cfb17STomasz Sapeta */ 627*fe5cfb17STomasz Sapeta onChange?: 628*fe5cfb17STomasz Sapeta | ((e: NativeSyntheticEvent<TextInputChangeEventData>) => void) 629*fe5cfb17STomasz Sapeta | undefined; 630*fe5cfb17STomasz Sapeta 631*fe5cfb17STomasz Sapeta /** 632*fe5cfb17STomasz Sapeta * Callback that is called when the text input's text changes. 633*fe5cfb17STomasz Sapeta * Changed text is passed as an argument to the callback handler. 634*fe5cfb17STomasz Sapeta */ 635*fe5cfb17STomasz Sapeta onChangeText?: ((text: string) => void) | undefined; 636*fe5cfb17STomasz Sapeta 637*fe5cfb17STomasz Sapeta /** 638*fe5cfb17STomasz Sapeta * Callback that is called when the text input's content size changes. 639*fe5cfb17STomasz Sapeta * This will be called with 640*fe5cfb17STomasz Sapeta * `{ nativeEvent: { contentSize: { width, height } } }`. 641*fe5cfb17STomasz Sapeta * 642*fe5cfb17STomasz Sapeta * Only called for multiline text inputs. 643*fe5cfb17STomasz Sapeta */ 644*fe5cfb17STomasz Sapeta onContentSizeChange?: 645*fe5cfb17STomasz Sapeta | ((e: NativeSyntheticEvent<TextInputContentSizeChangeEventData>) => void) 646*fe5cfb17STomasz Sapeta | undefined; 647*fe5cfb17STomasz Sapeta 648*fe5cfb17STomasz Sapeta /** 649*fe5cfb17STomasz Sapeta * Callback that is called when text input ends. 650*fe5cfb17STomasz Sapeta */ 651*fe5cfb17STomasz Sapeta onEndEditing?: 652*fe5cfb17STomasz Sapeta | ((e: NativeSyntheticEvent<TextInputEndEditingEventData>) => void) 653*fe5cfb17STomasz Sapeta | undefined; 654*fe5cfb17STomasz Sapeta 655*fe5cfb17STomasz Sapeta /** 656*fe5cfb17STomasz Sapeta * Callback that is called when a touch is engaged. 657*fe5cfb17STomasz Sapeta */ 658*fe5cfb17STomasz Sapeta onPressIn?: ((e: NativeSyntheticEvent<NativeTouchEvent>) => void) | undefined; 659*fe5cfb17STomasz Sapeta 660*fe5cfb17STomasz Sapeta /** 661*fe5cfb17STomasz Sapeta * Callback that is called when a touch is released. 662*fe5cfb17STomasz Sapeta */ 663*fe5cfb17STomasz Sapeta onPressOut?: 664*fe5cfb17STomasz Sapeta | ((e: NativeSyntheticEvent<NativeTouchEvent>) => void) 665*fe5cfb17STomasz Sapeta | undefined; 666*fe5cfb17STomasz Sapeta 667*fe5cfb17STomasz Sapeta /** 668*fe5cfb17STomasz Sapeta * Callback that is called when the text input is focused 669*fe5cfb17STomasz Sapeta */ 670*fe5cfb17STomasz Sapeta onFocus?: 671*fe5cfb17STomasz Sapeta | ((e: NativeSyntheticEvent<TextInputFocusEventData>) => void) 672*fe5cfb17STomasz Sapeta | undefined; 673*fe5cfb17STomasz Sapeta 674*fe5cfb17STomasz Sapeta /** 675*fe5cfb17STomasz Sapeta * Callback that is called when the text input selection is changed. 676*fe5cfb17STomasz Sapeta */ 677*fe5cfb17STomasz Sapeta onSelectionChange?: 678*fe5cfb17STomasz Sapeta | ((e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => void) 679*fe5cfb17STomasz Sapeta | undefined; 680*fe5cfb17STomasz Sapeta 681*fe5cfb17STomasz Sapeta /** 682*fe5cfb17STomasz Sapeta * Callback that is called when the text input's submit button is pressed. 683*fe5cfb17STomasz Sapeta */ 684*fe5cfb17STomasz Sapeta onSubmitEditing?: 685*fe5cfb17STomasz Sapeta | ((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void) 686*fe5cfb17STomasz Sapeta | undefined; 687*fe5cfb17STomasz Sapeta 688*fe5cfb17STomasz Sapeta /** 689*fe5cfb17STomasz Sapeta * Callback that is called on new text input with the argument 690*fe5cfb17STomasz Sapeta * `{ nativeEvent: { text, previousText, range: { start, end } } }`. 691*fe5cfb17STomasz Sapeta * 692*fe5cfb17STomasz Sapeta * This prop requires multiline={true} to be set. 693*fe5cfb17STomasz Sapeta */ 694*fe5cfb17STomasz Sapeta onTextInput?: 695*fe5cfb17STomasz Sapeta | ((e: NativeSyntheticEvent<TextInputTextInputEventData>) => void) 696*fe5cfb17STomasz Sapeta | undefined; 697*fe5cfb17STomasz Sapeta 698*fe5cfb17STomasz Sapeta /** 699*fe5cfb17STomasz Sapeta * Invoked on content scroll with 700*fe5cfb17STomasz Sapeta * `{ nativeEvent: { contentOffset: { x, y } } }`. 701*fe5cfb17STomasz Sapeta * 702*fe5cfb17STomasz Sapeta * May also contain other properties from ScrollEvent but on Android contentSize is not provided for performance reasons. 703*fe5cfb17STomasz Sapeta */ 704*fe5cfb17STomasz Sapeta onScroll?: 705*fe5cfb17STomasz Sapeta | ((e: NativeSyntheticEvent<TextInputScrollEventData>) => void) 706*fe5cfb17STomasz Sapeta | undefined; 707*fe5cfb17STomasz Sapeta 708*fe5cfb17STomasz Sapeta /** 709*fe5cfb17STomasz Sapeta * Callback that is called when a key is pressed. 710*fe5cfb17STomasz Sapeta * This will be called with 711*fe5cfb17STomasz Sapeta * `{ nativeEvent: { key: keyValue } }` 712*fe5cfb17STomasz Sapeta * where keyValue is 'Enter' or 'Backspace' for respective keys and the typed-in character otherwise including ' ' for space. 713*fe5cfb17STomasz Sapeta * 714*fe5cfb17STomasz Sapeta * Fires before onChange callbacks. 715*fe5cfb17STomasz Sapeta * Note: on Android only the inputs from soft keyboard are handled, not the hardware keyboard inputs. 716*fe5cfb17STomasz Sapeta */ 717*fe5cfb17STomasz Sapeta onKeyPress?: 718*fe5cfb17STomasz Sapeta | ((e: NativeSyntheticEvent<TextInputKeyPressEventData>) => void) 719*fe5cfb17STomasz Sapeta | undefined; 720*fe5cfb17STomasz Sapeta 721*fe5cfb17STomasz Sapeta /** 722*fe5cfb17STomasz Sapeta * The string that will be rendered before text input has been entered 723*fe5cfb17STomasz Sapeta */ 724*fe5cfb17STomasz Sapeta placeholder?: string | undefined; 725*fe5cfb17STomasz Sapeta 726*fe5cfb17STomasz Sapeta /** 727*fe5cfb17STomasz Sapeta * The text color of the placeholder string 728*fe5cfb17STomasz Sapeta */ 729*fe5cfb17STomasz Sapeta placeholderTextColor?: ColorValue | undefined; 730*fe5cfb17STomasz Sapeta 731*fe5cfb17STomasz Sapeta /** 732*fe5cfb17STomasz Sapeta * enum('default', 'go', 'google', 'join', 'next', 'route', 'search', 'send', 'yahoo', 'done', 'emergency-call') 733*fe5cfb17STomasz Sapeta * Determines how the return key should look. 734*fe5cfb17STomasz Sapeta */ 735*fe5cfb17STomasz Sapeta returnKeyType?: ReturnKeyTypeOptions | undefined; 736*fe5cfb17STomasz Sapeta 737*fe5cfb17STomasz Sapeta /** 738*fe5cfb17STomasz Sapeta * If true, the text input obscures the text entered so that sensitive text like passwords stay secure. 739*fe5cfb17STomasz Sapeta * The default value is false. 740*fe5cfb17STomasz Sapeta */ 741*fe5cfb17STomasz Sapeta secureTextEntry?: boolean | undefined; 742*fe5cfb17STomasz Sapeta 743*fe5cfb17STomasz Sapeta /** 744*fe5cfb17STomasz Sapeta * If true, all text will automatically be selected on focus 745*fe5cfb17STomasz Sapeta */ 746*fe5cfb17STomasz Sapeta selectTextOnFocus?: boolean | undefined; 747*fe5cfb17STomasz Sapeta 748*fe5cfb17STomasz Sapeta /** 749*fe5cfb17STomasz Sapeta * The start and end of the text input's selection. Set start and end to 750*fe5cfb17STomasz Sapeta * the same value to position the cursor. 751*fe5cfb17STomasz Sapeta */ 752*fe5cfb17STomasz Sapeta selection?: {start: number; end?: number | undefined} | undefined; 753*fe5cfb17STomasz Sapeta 754*fe5cfb17STomasz Sapeta /** 755*fe5cfb17STomasz Sapeta * The highlight (and cursor on ios) color of the text input 756*fe5cfb17STomasz Sapeta */ 757*fe5cfb17STomasz Sapeta selectionColor?: ColorValue | undefined; 758*fe5cfb17STomasz Sapeta 759*fe5cfb17STomasz Sapeta /** 760*fe5cfb17STomasz Sapeta * Styles 761*fe5cfb17STomasz Sapeta */ 762*fe5cfb17STomasz Sapeta style?: StyleProp<TextStyle> | undefined; 763*fe5cfb17STomasz Sapeta 764*fe5cfb17STomasz Sapeta /** 765*fe5cfb17STomasz Sapeta * Align the input text to the left, center, or right sides of the input field. 766*fe5cfb17STomasz Sapeta */ 767*fe5cfb17STomasz Sapeta textAlign?: 'left' | 'center' | 'right' | undefined; 768*fe5cfb17STomasz Sapeta 769*fe5cfb17STomasz Sapeta /** 770*fe5cfb17STomasz Sapeta * Used to locate this view in end-to-end tests 771*fe5cfb17STomasz Sapeta */ 772*fe5cfb17STomasz Sapeta testID?: string | undefined; 773*fe5cfb17STomasz Sapeta 774*fe5cfb17STomasz Sapeta /** 775*fe5cfb17STomasz Sapeta * Used to connect to an InputAccessoryView. Not part of react-natives documentation, but present in examples and 776*fe5cfb17STomasz Sapeta * code. 777*fe5cfb17STomasz Sapeta * See https://reactnative.dev/docs/inputaccessoryview for more information. 778*fe5cfb17STomasz Sapeta */ 779*fe5cfb17STomasz Sapeta inputAccessoryViewID?: string | undefined; 780*fe5cfb17STomasz Sapeta 781*fe5cfb17STomasz Sapeta /** 782*fe5cfb17STomasz Sapeta * The value to show for the text input. TextInput is a controlled component, 783*fe5cfb17STomasz Sapeta * which means the native value will be forced to match this value prop if provided. 784*fe5cfb17STomasz Sapeta * 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. 785*fe5cfb17STomasz Sapeta * In addition to simply setting the same value, either set editable={false}, 786*fe5cfb17STomasz Sapeta * or set/update maxLength to prevent unwanted edits without flicker. 787*fe5cfb17STomasz Sapeta */ 788*fe5cfb17STomasz Sapeta value?: string | undefined; 789*fe5cfb17STomasz Sapeta 790*fe5cfb17STomasz Sapeta /** 791*fe5cfb17STomasz Sapeta * Specifies largest possible scale a font can reach when allowFontScaling is enabled. Possible values: 792*fe5cfb17STomasz Sapeta * - null/undefined (default): inherit from the parent node or the global default (0) 793*fe5cfb17STomasz Sapeta * - 0: no max, ignore parent/global default 794*fe5cfb17STomasz Sapeta * - >= 1: sets the maxFontSizeMultiplier of this node to this value 795*fe5cfb17STomasz Sapeta */ 796*fe5cfb17STomasz Sapeta maxFontSizeMultiplier?: number | null | undefined; 797*fe5cfb17STomasz Sapeta} 798*fe5cfb17STomasz Sapeta 799*fe5cfb17STomasz Sapeta/** 800*fe5cfb17STomasz Sapeta * This class is responsible for coordinating the "focused" 801*fe5cfb17STomasz Sapeta * state for TextInputs. All calls relating to the keyboard 802*fe5cfb17STomasz Sapeta * should be funneled through here 803*fe5cfb17STomasz Sapeta */ 804*fe5cfb17STomasz Sapetainterface TextInputState { 805*fe5cfb17STomasz Sapeta /** 806*fe5cfb17STomasz Sapeta * @deprecated Use currentlyFocusedInput 807*fe5cfb17STomasz Sapeta * Returns the ID of the currently focused text field, if one exists 808*fe5cfb17STomasz Sapeta * If no text field is focused it returns null 809*fe5cfb17STomasz Sapeta */ 810*fe5cfb17STomasz Sapeta currentlyFocusedField(): number; 811*fe5cfb17STomasz Sapeta 812*fe5cfb17STomasz Sapeta /** 813*fe5cfb17STomasz Sapeta * Returns the ref of the currently focused text field, if one exists 814*fe5cfb17STomasz Sapeta * If no text field is focused it returns null 815*fe5cfb17STomasz Sapeta */ 816*fe5cfb17STomasz Sapeta currentlyFocusedInput(): React.ElementRef<HostComponent<unknown>>; 817*fe5cfb17STomasz Sapeta 818*fe5cfb17STomasz Sapeta /** 819*fe5cfb17STomasz Sapeta * @param textField ref of the text field to focus 820*fe5cfb17STomasz Sapeta * Focuses the specified text field 821*fe5cfb17STomasz Sapeta * noop if the text field was already focused 822*fe5cfb17STomasz Sapeta */ 823*fe5cfb17STomasz Sapeta focusTextInput(textField?: React.ElementRef<HostComponent<unknown>>): void; 824*fe5cfb17STomasz Sapeta 825*fe5cfb17STomasz Sapeta /** 826*fe5cfb17STomasz Sapeta * @param textField ref of the text field to focus 827*fe5cfb17STomasz Sapeta * Unfocuses the specified text field 828*fe5cfb17STomasz Sapeta * noop if it wasn't focused 829*fe5cfb17STomasz Sapeta */ 830*fe5cfb17STomasz Sapeta blurTextInput(textField?: React.ElementRef<HostComponent<unknown>>): void; 831*fe5cfb17STomasz Sapeta} 832*fe5cfb17STomasz Sapeta 833*fe5cfb17STomasz Sapeta/** 834*fe5cfb17STomasz Sapeta * @see https://reactnative.dev/docs/textinput#methods 835*fe5cfb17STomasz Sapeta */ 836*fe5cfb17STomasz Sapetadeclare class TextInputComponent extends React.Component<TextInputProps> {} 837*fe5cfb17STomasz Sapetadeclare const TextInputBase: Constructor<NativeMethods> & 838*fe5cfb17STomasz Sapeta Constructor<TimerMixin> & 839*fe5cfb17STomasz Sapeta typeof TextInputComponent; 840*fe5cfb17STomasz Sapetaexport class TextInput extends TextInputBase { 841*fe5cfb17STomasz Sapeta /** 842*fe5cfb17STomasz Sapeta * Access the current focus state. 843*fe5cfb17STomasz Sapeta */ 844*fe5cfb17STomasz Sapeta static State: TextInputState; 845*fe5cfb17STomasz Sapeta 846*fe5cfb17STomasz Sapeta /** 847*fe5cfb17STomasz Sapeta * Returns if the input is currently focused. 848*fe5cfb17STomasz Sapeta */ 849*fe5cfb17STomasz Sapeta isFocused: () => boolean; 850*fe5cfb17STomasz Sapeta 851*fe5cfb17STomasz Sapeta /** 852*fe5cfb17STomasz Sapeta * Removes all text from the input. 853*fe5cfb17STomasz Sapeta */ 854*fe5cfb17STomasz Sapeta clear: () => void; 855*fe5cfb17STomasz Sapeta} 856