Skip to content

Commit

Permalink
fix: fixed types props tabIndex in view and userSelect in text (#41312)
Browse files Browse the repository at this point in the history
Summary:
zfrankdesign reported that in RN 0.72.6, they receive warnings that some new props listed in the documents are missing:
View tabIndex https://reactnative.dev/docs/view#tabindex-android and Text userSelect https://reactnative.dev/docs/text#userselect. It seems the components accept these props but they were not typed.

## Changelog:

[GENERAL] [FIXED] - Missing typings for the props `tabIndex` for **View** and `userSelect` in the **Text** props were added.

Pull Request resolved: #41312

Test Plan:
1. Instantiate a component of type View
   1.1. Should add the property tabIndex to the View component.
   1.2. Should not see a warning about the missing tabIndex property.

2. Instantiate a component of type Text
   2.1. Should add the property userSelect to the Text component.
   2.2. Should not see a warning about the missing userSelect property.

Reviewed By: NickGerleman

Differential Revision: D50982156

Pulled By: lunaleaps

fbshipit-source-id: 75b55cfb897738be0cf426912a7c10c7412d5032
  • Loading branch information
wootsbot authored and facebook-github-bot committed Nov 4, 2023
1 parent 36ef646 commit b36505b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/react-native/Libraries/Components/View/ViewPropTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ export interface ViewPropsAndroid {
* Whether this `View` should be focusable with a non-touch input device, eg. receive focus with a hardware keyboard.
*/
focusable?: boolean | undefined;

/**
* Indicates whether this `View` should be focusable with a non-touch input device, eg. receive focus with a hardware keyboard.
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
* for more details.
*
* Supports the following values:
* - 0 (View is focusable)
* - -1 (View is not focusable)
*/
tabIndex?: 0 | -1 | undefined;
}

/**
Expand Down

0 comments on commit b36505b

Please sign in to comment.