Skip to content

Commit e8054cc

Browse files
feat: Allow the slider component to be styled (#900)
* feat: Allow the slider component to be styled Signed-off-by: Gegham Zakaryan <[email protected]> * feat: Allow the slider component to be styled Signed-off-by: Gegham Zakaryan <[email protected]> * fix: lint * fix: remove unnecessary code --------- Signed-off-by: Gegham Zakaryan <[email protected]> Co-authored-by: Gegham Zakaryan <[email protected]>
1 parent a0eaabc commit e8054cc

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,15 @@ An object container
241241

242242
Extends [ViewStyles](https://reactnative.dev/docs/view-style-props)
243243

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+
244253
## Tips and Tricks
245254

246255
### How can I increase the height of the tab ?

index.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ export interface SegmentedControlProps extends ViewProps {
111111
* Touchable style properties for Segmented Control Tab
112112
*/
113113
tabStyle?: ViewStyle;
114+
115+
/**
116+
* Style properties for the Animated.View component
117+
*/
118+
sliderStyle?: ViewStyle;
114119
}
115120

116121
/**

js/SegmentedControl.js

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const SegmentedControl = ({
3838
appearance,
3939
accessibilityHintSeperator = 'out of',
4040
testIDS,
41+
sliderStyle,
4142
}: SegmentedControlProps): React.Node => {
4243
const colorSchemeHook = useColorScheme();
4344
const colorScheme = appearance || colorSchemeHook;
@@ -118,6 +119,7 @@ const SegmentedControl = ({
118119
backgroundColor:
119120
tintColor || (colorScheme === 'dark' ? '#636366' : 'white'),
120121
},
122+
sliderStyle,
121123
]}
122124
/>
123125
) : null}

js/types.js

+4
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,8 @@ export type SegmentedControlProps = $ReadOnly<{|
112112
* array testID to each segment button
113113
*/
114114
testIDS: $ReadOnlyArray<string>,
115+
/**
116+
* Style properties for the slider component (Animated.View)
117+
*/
118+
sliderStyle?: ViewStyle,
115119
|}>;

0 commit comments

Comments
 (0)