@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 CHANGED
@@ -1,12 +1,7 @@
1
1
  import React from 'react';
2
- import {
3
- View,
4
- StyleSheet,
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
- if (allowRange?.length > 1 && value > get(allowRange, '[1]', max))
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
- { value: 1000000, symbol: LANGUAGE == 'en' ? 'M' : 'Tr' },
398
- { value: 1000, symbol: 'K' },
399
- { value: 1, symbol: '' },
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 && enableLabel && (
531
- <View
532
- style={[
533
- styles.valueContainer,
534
- Shadow.Dark,
535
- ]}>
536
- <Text.Label3>
537
- {markerLabel1}
538
- </Text.Label3>
539
- </View>
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 && enableLabel && (
553
- <View
554
- style={[
555
- styles.valueContainer,
556
- Shadow.Dark,
557
- ]}>
558
- <Text.Label3>
559
- {markerLabel2}
560
- </Text.Label3>
561
- </View>
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 && !disabled}
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 && enableLabel && (
591
- <View
592
- style={[
593
- styles.valueContainer,
594
- Shadow.Dark,
595
- ]}>
596
- <Text.Label3>
597
- {markerLabel2}
598
- </Text.Label3>
599
- </View>
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 && enableLabel && (
613
- <View
614
- style={[
615
- styles.valueContainer,
616
- Shadow.Dark,
617
- ]}>
618
- <Text.Label3>
619
- {markerLabel2}
620
- </Text.Label3>
621
- </View>
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: { width: '100%', height: '100%' },
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 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/slider",
3
- "version": "0.0.62-alpha.3",
3
+ "version": "0.0.62-alpha.32",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "dependencies": {},