react-native-multi-slider
react-native-multi-slider copied to clipboard
create lables on given positions?
is there a way to add lables on given positions? and steps seperators?
Hi! Not a direct solution to your question about given positions, but if you are interested in displaying the value with the markers as they move, you can create a custom marker similar to the given marker in DefaultMarker.js. You would only need to make one change to the render function inside DefaultMarker.js to show the values like so:
render() {
return (
<View> // WRAP ENTIRE THING IN ANOTHER VIEW
<Text style = {{flex: 0.3}}>{this.props.currentValue}</Text> // NEW LINE
<TouchableHighlight style = {{flex: 0.7}}>
<View
style={this.props.enabled ? [
styles.markerStyle,
this.props.markerStyle,
this.props.pressed && styles.pressedMarkerStyle,
this.props.pressed && this.props.pressedMarkerStyle,
] : [styles.markerStyle, styles.disabled]}
/>
</TouchableHighlight>
</View>
);
}
I chose the flex values to keep the marker centered on the track. Finally, you would specify the customMarker prop on your MultiSlider component:
<MultiSlider
...
customMarker = {myMarker}
/>
Hope this helps in some way!