From 3273d38d3bbcb0aa0a01cd6c5b959785db2a79dc Mon Sep 17 00:00:00 2001 From: Matthias Giger Date: Mon, 26 Jun 2023 04:12:38 -0700 Subject: [PATCH] Remove testID from TextStyle types (#38053) Summary: `testID` which is a valid prop for `` is also found in the types for `TextStyle`. This pull request removes said property from the styles. ## Changelog: General Fixed - Remove testID from TextStyle types Pull Request resolved: https://github.com/facebook/react-native/pull/38053 Test Plan: ```tsx const styles = StyleSheet.create({ view: { testID: 'should-error-in-typescript-but-does-not' } }) ``` `TextStyle` is used to type the `StyleSheet` along with `ViewStyle` and `ImageStyle` which do not contain `testID`. ```tsx const MyText = Hello ``` `testID` is used to identify components with the mentioned prop. This works for `Text` and will continue to do so, `TextProps` has `testID` added specifically. When using `getByTestId` in jest adding testID to the style already has no effect. When adding `testID` to a style a warning will already be shown in development: Warning: Failed prop type: Invalid props.style key `testID` supplied to `Text`. Reviewed By: javache Differential Revision: D47006787 Pulled By: NickGerleman fbshipit-source-id: 6993579ee9c173677594f8f3aea499ac8d8ab232 --- packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts index 7bc5365ae0ede9..75f625250c9b7c 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts +++ b/packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts @@ -335,7 +335,6 @@ export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle { textShadowOffset?: {width: number; height: number} | undefined; textShadowRadius?: number | undefined; textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase' | undefined; - testID?: string | undefined; } /**