mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add missing type for TextInput.readOnly in Typescript (#39281)
Summary: The `readOnly` prop is available in the `TextInput` implementation (see [usage https://github.com/facebook/react-native/issues/1](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/TextInput/TextInput.js#L1646), [usage https://github.com/facebook/react-native/issues/2](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/TextInput/TextInput.js#L1671)), but the corresponding Typescript type is currently missing. Those who use Typescript get an invalid prop error when using the `readOnly` prop on `TextInput`. Having this prop type included in TypeScript would fix the bug above and also would be beneficial for consistency and comprehensive type support. Notably, this prop is also included in the Flow types [here](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js#L814). ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [GENERAL] [FIXED] - Add missing type for TextInput.readOnly in Typescript Pull Request resolved: https://github.com/facebook/react-native/pull/39281 Test Plan: N/A Reviewed By: rshest Differential Revision: D48955477 Pulled By: NickGerleman fbshipit-source-id: 9d3431351b8ad65a4d2fc57939b98c167dc70cee
This commit is contained in:
committed by
Facebook GitHub Bot
parent
735f4ed62a
commit
deb81853f5
@@ -814,6 +814,11 @@ export interface TextInputProps
|
||||
*/
|
||||
placeholderTextColor?: ColorValue | undefined;
|
||||
|
||||
/**
|
||||
* If `true`, text is not editable. The default value is `false`.
|
||||
*/
|
||||
readOnly?: boolean | undefined;
|
||||
|
||||
/**
|
||||
* enum('default', 'go', 'google', 'join', 'next', 'route', 'search', 'send', 'yahoo', 'done', 'emergency-call')
|
||||
* Determines how the return key should look.
|
||||
|
||||
Reference in New Issue
Block a user