Skip to content

Commit 101f032

Browse files
committed
Merge branch 'master' of ssh://github.com/react-native-segmented-control/segmented-control
2 parents 32131e9 + ac33956 commit 101f032

6 files changed

+616
-530
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ React Native SegmentedControl library. Use SegmentedControl to render a UISegmen
66

77
For Android and Web, it has a js implementation that mocks iOS 13 style of UISegmentedControl.
88

9-
**For Expo Users:** Expo SDK 38 or later is required for this package.
10-
119
| iOS | Android | Web |
1210
| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
1311
| <img src="https://user-images.githubusercontent.com/6936373/71608757-dc6ef680-2bc6-11ea-85be-aa31f25ecf36.png" width="320" /> | <img src="https://user-images.githubusercontent.com/6936373/79550655-9edd9d00-80d3-11ea-98bf-8b7c0b0798d3.png" width="320" /> | <img src="https://user-images.githubusercontent.com/6936373/79590620-3f52b200-8112-11ea-863b-236c4465fba6.png" width="640"/> |

js/SegmentedControl.js

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const SegmentedControl = ({
3636
fontStyle,
3737
activeFontStyle,
3838
appearance,
39+
accessibilityHintSeperator = 'out of',
3940
}: SegmentedControlProps): React.Node => {
4041
const colorSchemeHook = useColorScheme();
4142
const colorScheme = appearance || colorSchemeHook;
@@ -99,6 +100,7 @@ const SegmentedControl = ({
99100
<SegmentedControlTab
100101
enabled={enabled}
101102
selected={selectedIndex === index}
103+
accessibilityHint={`${index + 1} ${accessibilityHintSeperator} ${values.length}`}
102104
key={index}
103105
value={value}
104106
tintColor={tintColor}
@@ -120,6 +122,7 @@ const SegmentedControl = ({
120122
{
121123
transform: [{translateX: animation}],
122124
width: segmentWidth - 4,
125+
zIndex: -1,
123126
backgroundColor:
124127
tintColor || (colorScheme === 'dark' ? '#636366' : 'white'),
125128
},

js/SegmentedControlTab.js

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type Props = $ReadOnly<{|
2727
activeFontStyle?: FontStyle,
2828
tabStyle?: ViewStyle,
2929
appearance?: 'dark' | 'light' | null,
30+
accessibilityHint?: string,
3031
|}>;
3132

3233
function isBase64(str) {
@@ -45,6 +46,7 @@ export const SegmentedControlTab = ({
4546
activeFontStyle = {},
4647
appearance,
4748
tabStyle,
49+
accessibilityHint,
4850
}: Props): React.Node => {
4951
const colorSchemeHook = useColorScheme();
5052
const colorScheme = appearance || colorSchemeHook;
@@ -88,6 +90,8 @@ export const SegmentedControlTab = ({
8890
style={[styles.container, tabStyle]}
8991
disabled={!enabled}
9092
onPress={onSelect}
93+
accessibilityHint={accessibilityHint}
94+
accessibilityRole="button"
9195
accessibilityState={{selected: selected, disabled: !enabled}}>
9296
<View style={styles.default}>
9397
{typeof value === 'number' || typeof value === 'object' ? (

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-native-segmented-control/segmented-control",
3-
"version": "2.4.3",
3+
"version": "2.5.0",
44
"description": "React Native SegmentedControlIOS library",
55
"main": "js/index.js",
66
"types": "index.d.ts",
@@ -51,7 +51,7 @@
5151
"react-native-web": "^0.14.10",
5252
"react-test-renderer": "17.0.2",
5353
"rimraf": "^3.0.2",
54-
"semantic-release": "^19.0.5",
54+
"semantic-release": "^23.0.6",
5555
"typescript": "^4"
5656
},
5757
"resolutions": {

0 commit comments

Comments
 (0)