microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.12k stars 1.13k forks source link

Fix incompatible types with react-native-picker and tabIndex #12548

Open TatianaKapos opened 6 months ago

TatianaKapos commented 6 months ago

Problem Description

Recent integration brought in https://github.com/facebook/react-native/pull/41312/files which adds tabIndex to ViewPropsAndriod however we already define tabIndex in https://github.com/microsoft/react-native-windows/blob/4253b3ad364057dc95d982698e661dec1c69baab/vnext/src/Libraries/Components/View/ViewPropTypes.d.ts#L224.

Currently fixed just by commenting out the change in our ViewProps https://github.com/microsoft/react-native-windows/blob/d360db8df2914dd02a78ec377d6fae77d4dbde90/packages/%40office-iss/react-native-win32/src/Libraries/Components/View/ViewPropTypes.d.ts#L163

Error:

image

Steps To Reproduce

  1. Delete commented out tabIndex
  2. Error will occur

Expected Results

Error should not occur

CLI version

npx react-native -v

Environment

npx react-native info

Target Platform Version

10.0.19041

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

Snack, code example, screenshot, or link to a repository

No response

chrisglein commented 6 months ago

Android is restricting this to a few values. And that matches the recommendations of the web prop. However that's a recommendation... other values are actually allowed. As such it seems like the types should express the valid range (not just the recommended range). This sounds like something we should talk about for an upstream change.

chrisglein commented 6 months ago

The xplat react RFC indicates that the intent is to not support a larger range for tabIndex. We need to identify if any active customers are using this. So, two paths:

A) We remove support for the larger range of values from RNW. B) We influence upstream to support the larger range.

To move folks off of this, we should make using non 0-1 values a yellow box error, keeping the forked typings until we've provided a compatibility window.