@momo-kits/slider 0.0.62-alpha.3 → 0.0.62-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DefaultMarker.js +3 -8
- package/Slider.js +78 -52
- package/package.json +1 -1
package/DefaultMarker.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Platform,
|
|
6
|
-
TouchableHighlight,
|
|
7
|
-
Text,
|
|
8
|
-
} from 'react-native';
|
|
9
|
-
import { Colors, Radius, Shadow, TouchableOpacity } from '@momo-kits/core-v2';
|
|
2
|
+
import { Platform, StyleSheet, View } from 'react-native';
|
|
3
|
+
import { Colors, Shadow, TouchableOpacity } from '@momo-kits/core-v2';
|
|
4
|
+
|
|
10
5
|
// import {Radius} from '../../core';
|
|
11
6
|
|
|
12
7
|
class DefaultMarker extends React.Component {
|
package/Slider.js
CHANGED
|
@@ -106,7 +106,6 @@ export default class Slider extends Component {
|
|
|
106
106
|
enabledOne,
|
|
107
107
|
allowOverlap,
|
|
108
108
|
minMarkerOverlapDistance,
|
|
109
|
-
// sliderLength,
|
|
110
109
|
touchDimensions,
|
|
111
110
|
snapped,
|
|
112
111
|
onChange,
|
|
@@ -150,10 +149,12 @@ export default class Slider extends Component {
|
|
|
150
149
|
sliderLength,
|
|
151
150
|
);
|
|
152
151
|
|
|
153
|
-
if (allowRange?.length > 0 && value < get(allowRange, '[0]', min))
|
|
152
|
+
if (allowRange?.length > 0 && value < get(allowRange, '[0]', min)) {
|
|
154
153
|
return;
|
|
155
|
-
|
|
154
|
+
}
|
|
155
|
+
if (allowRange?.length > 1 && value > get(allowRange, '[1]', max)) {
|
|
156
156
|
return;
|
|
157
|
+
}
|
|
157
158
|
|
|
158
159
|
const snappedValue = valueToPosition(
|
|
159
160
|
value,
|
|
@@ -394,9 +395,18 @@ export default class Slider extends Component {
|
|
|
394
395
|
}
|
|
395
396
|
|
|
396
397
|
const lookup = [
|
|
397
|
-
{
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
{
|
|
399
|
+
value: 1000000,
|
|
400
|
+
symbol: LANGUAGE == 'en' ? 'M' : 'Tr',
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
value: 1000,
|
|
404
|
+
symbol: 'K',
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
value: 1,
|
|
408
|
+
symbol: '',
|
|
409
|
+
},
|
|
400
410
|
];
|
|
401
411
|
|
|
402
412
|
let item = lookup.slice().find((item) => {
|
|
@@ -485,6 +495,7 @@ export default class Slider extends Component {
|
|
|
485
495
|
? inactiveColor
|
|
486
496
|
: activeColor,
|
|
487
497
|
},
|
|
498
|
+
!enabledOne && !twoMarkers && styles.disabledTrack,
|
|
488
499
|
]}
|
|
489
500
|
/>
|
|
490
501
|
<View
|
|
@@ -497,6 +508,7 @@ export default class Slider extends Component {
|
|
|
497
508
|
? activeColor
|
|
498
509
|
: inactiveColor,
|
|
499
510
|
},
|
|
511
|
+
!enabledOne && !enabledTwo && styles.disabledTrack,
|
|
500
512
|
]}
|
|
501
513
|
{...(twoMarkers
|
|
502
514
|
? this._panResponderBetween.panHandlers
|
|
@@ -527,17 +539,19 @@ export default class Slider extends Component {
|
|
|
527
539
|
{...this._panResponderOne.panHandlers}>
|
|
528
540
|
{isMarkersSeparated === false ? (
|
|
529
541
|
<>
|
|
530
|
-
{onePressed &&
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
542
|
+
{onePressed &&
|
|
543
|
+
enableLabel &&
|
|
544
|
+
enabledOne && (
|
|
545
|
+
<View
|
|
546
|
+
style={[
|
|
547
|
+
styles.valueContainer,
|
|
548
|
+
Shadow.Light,
|
|
549
|
+
]}>
|
|
550
|
+
<Text.Label3>
|
|
551
|
+
{markerLabel1}
|
|
552
|
+
</Text.Label3>
|
|
553
|
+
</View>
|
|
554
|
+
)}
|
|
541
555
|
<Marker
|
|
542
556
|
activeColor={activeColor}
|
|
543
557
|
enabled={enabledOne}
|
|
@@ -549,20 +563,22 @@ export default class Slider extends Component {
|
|
|
549
563
|
</>
|
|
550
564
|
) : (
|
|
551
565
|
<>
|
|
552
|
-
{onePressed &&
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
566
|
+
{onePressed &&
|
|
567
|
+
enableLabel &&
|
|
568
|
+
enabledOne && (
|
|
569
|
+
<View
|
|
570
|
+
style={[
|
|
571
|
+
styles.valueContainer,
|
|
572
|
+
Shadow.Light,
|
|
573
|
+
]}>
|
|
574
|
+
<Text.Label3>
|
|
575
|
+
{markerLabel1}
|
|
576
|
+
</Text.Label3>
|
|
577
|
+
</View>
|
|
578
|
+
)}
|
|
563
579
|
<MarkerLeft
|
|
564
580
|
activeColor={activeColor}
|
|
565
|
-
enabled={enabledOne
|
|
581
|
+
enabled={enabledOne}
|
|
566
582
|
pressed={onePressed}
|
|
567
583
|
currentValue={valueOne}
|
|
568
584
|
valuePrefix={valuePrefix}
|
|
@@ -587,17 +603,19 @@ export default class Slider extends Component {
|
|
|
587
603
|
{...this._panResponderTwo.panHandlers}>
|
|
588
604
|
{isMarkersSeparated === false ? (
|
|
589
605
|
<>
|
|
590
|
-
{twoPressed &&
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
606
|
+
{twoPressed &&
|
|
607
|
+
enableLabel &&
|
|
608
|
+
enabledTwo && (
|
|
609
|
+
<View
|
|
610
|
+
style={[
|
|
611
|
+
styles.valueContainer,
|
|
612
|
+
Shadow.Light,
|
|
613
|
+
]}>
|
|
614
|
+
<Text.Label3>
|
|
615
|
+
{markerLabel2}
|
|
616
|
+
</Text.Label3>
|
|
617
|
+
</View>
|
|
618
|
+
)}
|
|
601
619
|
<Marker
|
|
602
620
|
activeColor={activeColor}
|
|
603
621
|
pressed={twoPressed}
|
|
@@ -609,17 +627,19 @@ export default class Slider extends Component {
|
|
|
609
627
|
</>
|
|
610
628
|
) : (
|
|
611
629
|
<>
|
|
612
|
-
{twoPressed &&
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
630
|
+
{twoPressed &&
|
|
631
|
+
enableLabel &&
|
|
632
|
+
enabledTwo && (
|
|
633
|
+
<View
|
|
634
|
+
style={[
|
|
635
|
+
styles.valueContainer,
|
|
636
|
+
Shadow.Light,
|
|
637
|
+
]}>
|
|
638
|
+
<Text.Label3>
|
|
639
|
+
{markerLabel2}
|
|
640
|
+
</Text.Label3>
|
|
641
|
+
</View>
|
|
642
|
+
)}
|
|
623
643
|
<MarkerRight
|
|
624
644
|
activeColor={activeColor}
|
|
625
645
|
pressed={twoPressed}
|
|
@@ -679,7 +699,10 @@ const styles = StyleSheet.create({
|
|
|
679
699
|
alignItems: 'center',
|
|
680
700
|
alignSelf: 'stretch',
|
|
681
701
|
},
|
|
682
|
-
full: {
|
|
702
|
+
full: {
|
|
703
|
+
width: '100%',
|
|
704
|
+
height: '100%',
|
|
705
|
+
},
|
|
683
706
|
valueContainer: {
|
|
684
707
|
height: 24,
|
|
685
708
|
borderRadius: Spacing.XS,
|
|
@@ -691,6 +714,9 @@ const styles = StyleSheet.create({
|
|
|
691
714
|
paddingVertical: Spacing.XS,
|
|
692
715
|
paddingHorizontal: Spacing.S,
|
|
693
716
|
},
|
|
717
|
+
disabledTrack: {
|
|
718
|
+
backgroundColor: Colors.black_08,
|
|
719
|
+
},
|
|
694
720
|
});
|
|
695
721
|
|
|
696
722
|
Slider.defaultProps = {
|