@react-native-segmented-control/segmented-control 2.4.3 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,8 +6,6 @@ React Native SegmentedControl library. Use SegmentedControl to render a UISegmen
6
6
 
7
7
  For Android and Web, it has a js implementation that mocks iOS 13 style of UISegmentedControl.
8
8
 
9
- **For Expo Users:** Expo SDK 38 or later is required for this package.
10
-
11
9
  | iOS | Android | Web |
12
10
  | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
13
11
  | <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"/> |
@@ -36,6 +36,7 @@ const SegmentedControl = ({
36
36
  fontStyle,
37
37
  activeFontStyle,
38
38
  appearance,
39
+ accessibilityHintSeperator = 'out of',
39
40
  }: SegmentedControlProps): React.Node => {
40
41
  const colorSchemeHook = useColorScheme();
41
42
  const colorScheme = appearance || colorSchemeHook;
@@ -99,6 +100,7 @@ const SegmentedControl = ({
99
100
  <SegmentedControlTab
100
101
  enabled={enabled}
101
102
  selected={selectedIndex === index}
103
+ accessibilityHint={`${index + 1} ${accessibilityHintSeperator} ${values.length}`}
102
104
  key={index}
103
105
  value={value}
104
106
  tintColor={tintColor}
@@ -120,6 +122,7 @@ const SegmentedControl = ({
120
122
  {
121
123
  transform: [{translateX: animation}],
122
124
  width: segmentWidth - 4,
125
+ zIndex: -1,
123
126
  backgroundColor:
124
127
  tintColor || (colorScheme === 'dark' ? '#636366' : 'white'),
125
128
  },
@@ -27,6 +27,7 @@ type Props = $ReadOnly<{|
27
27
  activeFontStyle?: FontStyle,
28
28
  tabStyle?: ViewStyle,
29
29
  appearance?: 'dark' | 'light' | null,
30
+ accessibilityHint?: string,
30
31
  |}>;
31
32
 
32
33
  function isBase64(str) {
@@ -45,6 +46,7 @@ export const SegmentedControlTab = ({
45
46
  activeFontStyle = {},
46
47
  appearance,
47
48
  tabStyle,
49
+ accessibilityHint,
48
50
  }: Props): React.Node => {
49
51
  const colorSchemeHook = useColorScheme();
50
52
  const colorScheme = appearance || colorSchemeHook;
@@ -88,6 +90,8 @@ export const SegmentedControlTab = ({
88
90
  style={[styles.container, tabStyle]}
89
91
  disabled={!enabled}
90
92
  onPress={onSelect}
93
+ accessibilityHint={accessibilityHint}
94
+ accessibilityRole="button"
91
95
  accessibilityState={{selected: selected, disabled: !enabled}}>
92
96
  <View style={styles.default}>
93
97
  {typeof value === 'number' || typeof value === 'object' ? (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-segmented-control/segmented-control",
3
- "version": "2.4.3",
3
+ "version": "2.5.0",
4
4
  "description": "React Native SegmentedControlIOS library",
5
5
  "main": "js/index.js",
6
6
  "types": "index.d.ts",