问题描述:

I'm using react-native and for a component I need to replace the default image of the SliderIOS component with a custom one. Is there any way of accomplishing this or should I create a custom slider component? (I don't have any experience in this.)

I have already tried embedding an image as a child of the slider as well as the vice-versa approach, however non of them have worked.

网友答案:

Looking at the source code for RCTSliderManager, we can see that it only exposes value, maximumValue, minimumValue, minimumTrackTintColor and maximumTrackTintColor. That means like it looks like you're out of luck. You could use the RCTSlider and RCTSliderManager files as a starting point for a custom component, or you could create a pull request to expose setThumbImage on UISlider.

网友答案:

I have created a pull request fixing this issue which hopefully gets accepted.

相关阅读:
Top