@react-native-segmented-control/segmented-control 2.5.5 → 2.5.7
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 +9 -0
- package/index.d.ts +5 -0
- package/js/SegmentedControl.js +3 -1
- package/js/SegmentedControlTab.js +7 -1
- package/js/types.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -241,6 +241,15 @@ An object container
|
|
|
241
241
|
|
|
242
242
|
Extends [ViewStyles](https://reactnative.dev/docs/view-style-props)
|
|
243
243
|
|
|
244
|
+
### `sliderStyle`
|
|
245
|
+
|
|
246
|
+
(Android and Web only) Styles the slider component (Animated.View)
|
|
247
|
+
| Type | Required | Platform |
|
|
248
|
+
| ------ | -------- | -------- |
|
|
249
|
+
| object | No | Android, Web |
|
|
250
|
+
|
|
251
|
+
Extends [ViewStyles](https://reactnative.dev/docs/view-style-props)
|
|
252
|
+
|
|
244
253
|
## Tips and Tricks
|
|
245
254
|
|
|
246
255
|
### How can I increase the height of the tab ?
|
package/index.d.ts
CHANGED
|
@@ -111,6 +111,11 @@ export interface SegmentedControlProps extends ViewProps {
|
|
|
111
111
|
* Touchable style properties for Segmented Control Tab
|
|
112
112
|
*/
|
|
113
113
|
tabStyle?: ViewStyle;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Style properties for the Animated.View component
|
|
117
|
+
*/
|
|
118
|
+
sliderStyle?: ViewStyle;
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
/**
|
package/js/SegmentedControl.js
CHANGED
|
@@ -38,6 +38,7 @@ const SegmentedControl = ({
|
|
|
38
38
|
appearance,
|
|
39
39
|
accessibilityHintSeperator = 'out of',
|
|
40
40
|
testIDS,
|
|
41
|
+
sliderStyle,
|
|
41
42
|
}: SegmentedControlProps): React.Node => {
|
|
42
43
|
const colorSchemeHook = useColorScheme();
|
|
43
44
|
const colorScheme = appearance || colorSchemeHook;
|
|
@@ -84,7 +85,7 @@ const SegmentedControl = ({
|
|
|
84
85
|
if (ref.current) {
|
|
85
86
|
ref.current.measure((_x, _y, width) => updateSegmentWidth(width));
|
|
86
87
|
}
|
|
87
|
-
}, [values]);
|
|
88
|
+
}, [values, updateSegmentWidth]);
|
|
88
89
|
|
|
89
90
|
return (
|
|
90
91
|
<View
|
|
@@ -118,6 +119,7 @@ const SegmentedControl = ({
|
|
|
118
119
|
backgroundColor:
|
|
119
120
|
tintColor || (colorScheme === 'dark' ? '#636366' : 'white'),
|
|
120
121
|
},
|
|
122
|
+
sliderStyle,
|
|
121
123
|
]}
|
|
122
124
|
/>
|
|
123
125
|
) : null}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
TouchableOpacity,
|
|
14
14
|
View,
|
|
15
15
|
useColorScheme,
|
|
16
|
+
Platform,
|
|
16
17
|
} from 'react-native';
|
|
17
18
|
|
|
18
19
|
import type {FontStyle, ViewStyle} from './types';
|
|
@@ -95,7 +96,12 @@ export const SegmentedControlTab = ({
|
|
|
95
96
|
accessibilityHint={accessibilityHint}
|
|
96
97
|
accessibilityRole="button"
|
|
97
98
|
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
|
+
})}>
|
|
99
105
|
<View style={styles.default}>
|
|
100
106
|
{typeof value === 'number' || typeof value === 'object' ? (
|
|
101
107
|
<Image source={value} style={styles.segmentImage} />
|
package/js/types.js
CHANGED