Skip to content

Commit

Permalink
feat: added props trackOneRender, support user deliver custom element…
Browse files Browse the repository at this point in the history
… ( react-native-linear-gradient )
  • Loading branch information
itenl committed Jul 27, 2021
1 parent 9f00ff1 commit 63e7b4a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions MultiSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default class MultiSlider extends React.Component {
vertical: false,
minMarkerOverlapDistance: 0,
minMarkerOverlapStepDistance: 0,
trackOneRender: null,
testID: '',
};

Expand Down Expand Up @@ -486,6 +487,12 @@ export default class MultiSlider extends React.Component {
});
}

renderTrackOne(styles) {
const { trackOneRender } = this.props;
if (trackOneRender && typeof trackOneRender === 'function') return trackOneRender(styles)
return <View style={styles} />
}

render() {
const { positionOne, positionTwo } = this.state;
const {
Expand Down Expand Up @@ -548,14 +555,12 @@ export default class MultiSlider extends React.Component {
const body = (
<React.Fragment>
<View style={[styles.fullTrack, { width: sliderLength }]}>
<View
style={[
styles.track,
this.props.trackStyle,
trackOneStyle,
{ width: trackOneLength },
]}
/>
{this.renderTrackOne([
styles.track,
this.props.trackStyle,
trackOneStyle,
{ width: trackOneLength },
])}
<View
style={[
styles.track,
Expand Down

0 comments on commit 63e7b4a

Please sign in to comment.