Expose thumbStyle prop#60
Conversation
| /** | ||
| * Optional style applied to the thumb of the slider. | ||
| */ | ||
| thumbStyle?: ViewStyle; |
There was a problem hiding this comment.
Maybe use StyleProp instead of bare ViewStyle here. This way the style props accept not only ViewStyle types, but also a (recursive) array of ViewStyle, and a Falsy type, which translates to false || null || undefined.
A user can then pass:
- array of styles:
style={[styles.style1, styles.style2]} - any
Falsyvalue, such asstyle={undefined}
which is not possible with bare ViewStyle.
We should probably do the same lateron for the other style properties here, once SeekBar supports it.
| thumbStyle?: ViewStyle; | |
| thumbStyle?: StyleProp<ViewStyle>; |
There was a problem hiding this comment.
That makes sense, thanks for the advice!
There was a problem hiding this comment.
Since the underlying Slider component only accepts ViewStyle | undefined for thumbStyle, I added StyleSheet.flatten when passing. However, I am not sure what exactly is best practice here so let me know what you think.
There was a problem hiding this comment.
Ah yes, it's the same issue as with the other style props on react-native-slide. I opened a PR for this a while ago.
I guess flattening is OK for now.
Co-authored-by: Tom Van Laerhoven <50482423+tvanlaerhoven@users.noreply.github.com>
This change updates the SeekBarProps interface to include an optional
thumbStyle?: ViewStyleprop and pass it directly to theSlidercomponent.Closes #59