Skip to content

Commit

Permalink
Add TextInput's inputMode TypeScript types (#35987)
Browse files Browse the repository at this point in the history
Summary:
Forward-porting DefinitelyTyped/DefinitelyTyped#64100

## Changelog

[GENERAL] [FIXED] - Add `TextInput`'s `inputMode` TypeScript types

Pull Request resolved: #35987

Test Plan: - [x] DefinitelyTyped/DefinitelyTyped#64100 green

Reviewed By: christophpurrer

Differential Revision: D42799862

Pulled By: jacdebug

fbshipit-source-id: b387fd8bc53e66d6125fee810862de3e292e6e74
  • Loading branch information
eps1lon authored and facebook-github-bot committed Jan 27, 2023
1 parent a00cea4 commit fac7859
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Libraries/Components/TextInput/TextInput.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ export type KeyboardTypeOptions =
| KeyboardTypeAndroid
| KeyboardTypeIOS;

export type InputModeOptions =
| 'none'
| 'text'
| 'decimal'
| 'numeric'
| 'tel'
| 'search'
| 'email'
| 'url';

export type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send';
export type ReturnKeyTypeAndroid = 'none' | 'previous';
export type ReturnKeyTypeIOS =
Expand Down Expand Up @@ -588,6 +598,11 @@ export interface TextInputProps
*/
keyboardType?: KeyboardTypeOptions | undefined;

/**
* Works like the inputmode attribute in HTML, it determines which keyboard to open, e.g. numeric and has precedence over keyboardType.
*/
inputMode?: InputModeOptions | undefined;

/**
* Limits the maximum number of characters that can be entered.
* Use this instead of implementing the logic in JS to avoid flicker.
Expand Down

0 comments on commit fac7859

Please sign in to comment.