Skip to content

Commit 0ad98f3

Browse files
KevinGuljsatya164
authored andcommitted
fix: pass down testID from Card props to Touchable for Detox tests (#683)
1 parent 68a5b78 commit 0ad98f3

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/components/Card/Card.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ type Props = React.ElementConfig<typeof Surface> & {|
3636
* @optional
3737
*/
3838
theme: Theme,
39+
/**
40+
* Pass down testID from card props to touchable
41+
*/
42+
testID?: string,
3943
|};
4044

4145
type State = {
@@ -112,6 +116,7 @@ class Card extends React.Component<Props, State> {
112116
onPress,
113117
style,
114118
theme,
119+
testID,
115120
...rest
116121
} = this.props;
117122
const { elevation } = this.state;
@@ -136,6 +141,7 @@ class Card extends React.Component<Props, State> {
136141
onPress={onPress}
137142
onPressIn={onPress ? this._handlePressIn : undefined}
138143
onPressOut={onPress ? this._handlePressOut : undefined}
144+
testID={testID}
139145
>
140146
<View style={styles.innerContainer}>
141147
{React.Children.map(

typings/components/Card.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export interface CardProps {
1919
children: React.ReactNode;
2020
style?: any;
2121
theme?: ThemeShape;
22+
testID?: string;
2223
}
2324

2425
export declare class Card extends React.Component<CardProps> {

0 commit comments

Comments
 (0)