Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thumb image style prop #126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ style | [style](http://facebook.github.io/react-native/docs/view
trackStyle | [style](http://facebook.github.io/react-native/docs/view.html#style) | Yes | | The style applied to the track
thumbStyle | [style](http://facebook.github.io/react-native/docs/view.html#style) | Yes | | The style applied to the thumb
thumbImage | [source](http://facebook.github.io/react-native/docs/image.html#source) | Yes | | Sets an image for the thumb.
thumbImage | [style](http://facebook.github.io/react-native/docs/view.html#style) | Yes | | The style applied to the thumb, if used.
debugTouchArea | bool | Yes | false | Set this to true to visually see the thumb touch rect in green.
animateTransitions | bool | Yes | false | Set to true if you want to use the default 'spring' animation
animationType | string | Yes | 'timing' | Set to 'spring' or 'timing' to use one of those two types of animations with the default [animation properties](https://facebook.github.io/react-native/docs/animations.html).
animationConfig | object | Yes | undefined | Used to configure the animation parameters. These are the same parameters in the [Animated library](https://facebook.github.io/react-native/docs/animations.html).
animationConfig | object | Yes | undefined | Used to configure the animation parameters. These are the same parameters in the [Animated library](https://facebook.github.io/react-native/docs/animations.html).


---
Expand Down
9 changes: 7 additions & 2 deletions src/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ export default class Slider extends PureComponent {
*/
thumbImage: Image.propTypes.source,

/**
* The style applied to the thumb image, if used
*/
thumbImageStyle: ViewPropTypes.style,

/**
* Set this to true to visually see the thumb touch rect in green.
*/
Expand Down Expand Up @@ -558,11 +563,11 @@ export default class Slider extends PureComponent {
};

_renderThumbImage = () => {
const { thumbImage } = this.props;
const { thumbImage, thumbImageStyle } = this.props;

if (!thumbImage) return;

return <Image source={thumbImage} />;
return <Image source={thumbImage} style={thumbImageStyle} />;
};
}

Expand Down