Skip to content

Commit 5f72e50

Browse files
authored
added accessibility id as a locator (#896)
* added accessibility id as a locator * addressed lint checks
1 parent 28304a0 commit 5f72e50

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

js/SegmentedControlTab.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
TouchableOpacity,
1414
View,
1515
useColorScheme,
16+
Platform,
1617
} from 'react-native';
1718

1819
import type {FontStyle, ViewStyle} from './types';
@@ -95,7 +96,12 @@ export const SegmentedControlTab = ({
9596
accessibilityHint={accessibilityHint}
9697
accessibilityRole="button"
9798
accessibilityState={{selected: selected, disabled: !enabled}}
98-
testID={testID}>
99+
testID={testID}
100+
accessible={true}
101+
accessibilityLabel={Platform.select({
102+
android: testID,
103+
ios: typeof value === 'string' ? value : testID,
104+
})}>
99105
<View style={styles.default}>
100106
{typeof value === 'number' || typeof value === 'object' ? (
101107
<Image source={value} style={styles.segmentImage} />

0 commit comments

Comments
 (0)