mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove testID from TextStyle types (#38053)
Summary: `testID` which is a valid prop for `<Text>` 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 = <Text testID="already-typed-fine">Hello</Text> ``` `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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c5a1f70087
commit
3273d38d3b
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user