Skip to content

Expose thumbStyle prop#60

Merged
tvanlaerhoven merged 3 commits into
THEOplayer:developfrom
QuintonWehby:Expose-thumbStyle-prop
Jun 26, 2025
Merged

Expose thumbStyle prop#60
tvanlaerhoven merged 3 commits into
THEOplayer:developfrom
QuintonWehby:Expose-thumbStyle-prop

Conversation

@QuintonWehby
Copy link
Copy Markdown
Contributor

@QuintonWehby QuintonWehby commented Jun 20, 2025

This change updates the SeekBarProps interface to include an optional thumbStyle?: ViewStyle prop and pass it directly to the Slider component.

Closes #59

@tjtheo tjtheo requested a review from tvanlaerhoven June 24, 2025 14:29
Comment thread src/ui/components/seekbar/SeekBar.tsx Outdated
/**
* Optional style applied to the thumb of the slider.
*/
thumbStyle?: ViewStyle;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Falsy value, such as style={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.

Suggested change
thumbStyle?: ViewStyle;
thumbStyle?: StyleProp<ViewStyle>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, thanks for the advice!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@tvanlaerhoven tvanlaerhoven merged commit fc8b409 into THEOplayer:develop Jun 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose thumbStyle prop in SeekBar component

2 participants