Skip to content

Commit bbb7fbe

Browse files
committed
Added testid to the expandablesection
1 parent 40879e5 commit bbb7fbe

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/components/expandableSection/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export type ExpandableSectionProps = {
2525
* action for when pressing the header of the expandableSection
2626
*/
2727
onPress?: () => void;
28+
/**
29+
* Testing identifier
30+
*/
31+
testID?: string;
2832
};
2933

3034
/**
@@ -34,7 +38,7 @@ export type ExpandableSectionProps = {
3438
*/
3539

3640
function ExpandableSection(props: ExpandableSectionProps) {
37-
const {expanded, sectionHeader, children, top} = props;
41+
const {expanded, sectionHeader, children, top, testID} = props;
3842

3943
/**
4044
* TODO: move to reanimated LayoutAnimation after updating to version 2.3.0
@@ -60,7 +64,7 @@ function ExpandableSection(props: ExpandableSectionProps) {
6064
return (
6165
<View style={styles.container}>
6266
{top && expanded && children}
63-
<TouchableOpacity onPress={onPress} accessibilityState={accessibilityState}>
67+
<TouchableOpacity onPress={onPress} testID={testID} accessibilityState={accessibilityState}>
6468
{sectionHeader}
6569
</TouchableOpacity>
6670
{!top && expanded && children}

src/components/touchableOpacity/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export interface TouchableOpacityProps
4848
* Custom value of any type to pass on to TouchableOpacity and receive back in onPress callback
4949
*/
5050
customValue?: any;
51+
/**
52+
* Testing identifier
53+
*/
54+
testID?: string;
5155
style?: ViewProps['style'];
5256
onPress?: (props?: (TouchableOpacityProps & {event: GestureResponderEvent}) | any) => void;
5357
onPressIn?: (

0 commit comments

Comments
 (0)