Skip to content

Conversation

@bdtren
Copy link

@bdtren bdtren commented Dec 29, 2025

Summary:

This PR adds a new thumbSize prop to control the thumb’s size for both with and without thumb image. It is a simple feature that I need and did patch-package in some of my projects but I didn't have a chance to contribute, I think some developers might also need it:

Android iOS
Android iOS

Test Plan:

  • Install/refresh package:
npm install
npm run refresh-package
  • Android:
npm run example-android

Verify in the example list:
“Custom thumb size (no image)” renders a larger thumb (e.g. thumbSize={32}) tinted with thumbTintColor.
“Custom thumb size (scaled image)” renders the thumb image scaled to the configured size (e.g. thumbSize={60}).

  • iOS:
npm run example-ios

Verify the same two examples behave equivalently on iOS (thumb resizes; image scales when provided).

@BartoszKlonowski BartoszKlonowski self-requested a review January 12, 2026 12:12
@BartoszKlonowski BartoszKlonowski linked an issue Jan 12, 2026 that may be closed by this pull request
@draggie draggie self-assigned this Jan 13, 2026
Copy link
Member

@BartoszKlonowski BartoszKlonowski left a comment

Choose a reason for hiding this comment

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

So far I have some cosmetic comments and a question before I'll dive deeper into the implementation itself.

Comment on lines +63 to +68
/**
* Sets the size (width and height) of the thumb.
* If `thumbImage` is provided, it will be scaled to this size.
*/
thumbSize?: number;

Copy link
Member

Choose a reason for hiding this comment

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

No need to include it explicitly per each platform, especially you already included this new prop in SliderProps.
Let's remove it from here.

Comment on lines +37 to +40
/**
* Sets the size (width and height) of the thumb, in points (dp on Android).
* If you also set `thumbImage`, the image will be scaled to this size.
*/
Copy link
Member

Choose a reason for hiding this comment

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

We don't need to comment on props that are added here specifically for the codegen to create a component properly. We can remove this comment.

? 'transparent'
: props.thumbTintColor
}
thumbSize={props.thumbSize}
Copy link
Member

Choose a reason for hiding this comment

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

We are already spreading all {...props} in line 313, so no need to explicitly pass it here if there's no operations done on that and the name matches.
Let me know if I'm not mistaken here.

[self->slider setThumbImage:nil];
}];
}
if (oldScreenProps.thumbTintColor != newScreenProps.thumbTintColor && slider.thumbSize > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm having a hard time understanding this part - can you elaborate on why do we check for thumbTintColor (again) when updateThumbImage is called and why do we limit thumbSize to bigger than 0px?

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.

How to adjust the size of the thumb button

3 participants