|
6 | 6 | PanResponder,
|
7 | 7 | View,
|
8 | 8 | Platform,
|
9 |
| - Dimensions, |
10 | 9 | I18nManager,
|
11 | 10 | ImageBackground,
|
12 | 11 | } from 'react-native';
|
@@ -53,7 +52,8 @@ export default class MultiSlider extends React.Component {
|
53 | 52 | vertical: false,
|
54 | 53 | minMarkerOverlapDistance: 0,
|
55 | 54 | minMarkerOverlapStepDistance: 0,
|
56 |
| - testID: '', |
| 55 | + testID: undefined, |
| 56 | + renderTrack: undefined, |
57 | 57 | };
|
58 | 58 |
|
59 | 59 | constructor(props) {
|
@@ -494,6 +494,7 @@ export default class MultiSlider extends React.Component {
|
494 | 494 | sliderLength,
|
495 | 495 | markerOffsetX,
|
496 | 496 | markerOffsetY,
|
| 497 | + renderTrack, |
497 | 498 | } = this.props;
|
498 | 499 | const twoMarkers = this.props.values.length == 2; // when allowOverlap, positionTwo could be 0, identified as string '0' and throwing 'RawText 0 needs to be wrapped in <Text>' error
|
499 | 500 |
|
@@ -548,23 +549,48 @@ export default class MultiSlider extends React.Component {
|
548 | 549 | const body = (
|
549 | 550 | <React.Fragment>
|
550 | 551 | <View style={[styles.fullTrack, { width: sliderLength }]}>
|
551 |
| - <View |
552 |
| - style={[ |
553 |
| - styles.track, |
554 |
| - this.props.trackStyle, |
555 |
| - trackOneStyle, |
556 |
| - { width: trackOneLength }, |
557 |
| - ]} |
558 |
| - /> |
559 |
| - <View |
560 |
| - style={[ |
561 |
| - styles.track, |
562 |
| - this.props.trackStyle, |
563 |
| - trackTwoStyle, |
564 |
| - { width: trackTwoLength }, |
565 |
| - ]} |
566 |
| - {...(twoMarkers ? this._panResponderBetween.panHandlers : {})} |
567 |
| - /> |
| 552 | + {renderTrack ? ( |
| 553 | + renderTrack({ |
| 554 | + selectedStyle: !twoMarkers, |
| 555 | + style: [ |
| 556 | + styles.track, |
| 557 | + this.props.trackStyle, |
| 558 | + trackOneStyle, |
| 559 | + { width: trackOneLength }, |
| 560 | + ], |
| 561 | + }) |
| 562 | + ) : ( |
| 563 | + <View |
| 564 | + style={[ |
| 565 | + styles.track, |
| 566 | + this.props.trackStyle, |
| 567 | + trackOneStyle, |
| 568 | + { width: trackOneLength }, |
| 569 | + ]} |
| 570 | + /> |
| 571 | + )} |
| 572 | + {renderTrack ? ( |
| 573 | + renderTrack({ |
| 574 | + selectedStyle: !!twoMarkers, |
| 575 | + style: [ |
| 576 | + styles.track, |
| 577 | + this.props.trackStyle, |
| 578 | + trackTwoStyle, |
| 579 | + { width: trackTwoLength }, |
| 580 | + ], |
| 581 | + ...(twoMarkers ? this._panResponderBetween.panHandlers : {}), |
| 582 | + }) |
| 583 | + ) : ( |
| 584 | + <View |
| 585 | + style={[ |
| 586 | + styles.track, |
| 587 | + this.props.trackStyle, |
| 588 | + trackTwoStyle, |
| 589 | + { width: trackTwoLength }, |
| 590 | + ]} |
| 591 | + {...(twoMarkers ? this._panResponderBetween.panHandlers : {})} |
| 592 | + /> |
| 593 | + )} |
568 | 594 | {twoMarkers && (
|
569 | 595 | <View
|
570 | 596 | style={[
|
|
0 commit comments