react-native-slider-picker
Advanced tools
Comparing version 1.0.28 to 1.0.29
{ | ||
"name": "react-native-slider-picker", | ||
"version": "1.0.28", | ||
"version": "1.0.29", | ||
"description": "Custom range slide picker for React Native. 🚧 UNDER CONSTRUCTION 🚧", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -90,4 +90,5 @@ /** | ||
// If maxValue is greater than 15, force scale-related values to false. | ||
if (this.maxValue > 15) { | ||
// If maxValue is greater than 10 or if slider will take up less than 50% of | ||
// viewport width, force scale-related values to false. | ||
if (this.maxValue > 10 || this.widthPercentage <= 50) { | ||
this.showNumberScale = false; | ||
@@ -136,8 +137,14 @@ this.showSeparatorScale = false; | ||
sliderInnerStyles['height'] = vh(this.heightPercentage); | ||
sliderInnerStyles['width'] = vw(this.widthPercentage); | ||
sliderInnerStyles['backgroundColor'] = this.sliderInnerBackgroundColor; | ||
// Make copies of containers with a set width. | ||
let wrapperStyles = Object.assign({}, styles.wrapper); | ||
wrapperStyles['width'] = vw(this.widthPercentage); | ||
return ( | ||
// Wrapper for slider | ||
<TouchableOpacity | ||
style={styles.wrapper} | ||
style={wrapperStyles} | ||
activeOpacity={1} | ||
@@ -162,3 +169,2 @@ onPress={(evt) => this.handleWrapperPress(evt.nativeEvent.locationX)} | ||
<SliderPickerCursor | ||
minOffset={vw(12.5)} | ||
maxOffset={vw(this.widthPercentage)} | ||
@@ -207,2 +213,5 @@ defaultValue={this.defaultValue} | ||
// Set width according to props.widthPercentage | ||
this.labelsContainerStyles['width'] = vw(this.widthPercentage); | ||
// Set label styles | ||
@@ -354,4 +363,8 @@ this.labelStyles['color'] = this.labelFontColor; | ||
// Set width of separator container | ||
let separatorContainerStyles = Object.assign({}, styles.separatorContainer); | ||
separatorContainerStyles['width'] = vw(this.widthPercentage); | ||
return ( | ||
<View style={styles.separatorContainer}> | ||
<View style={separatorContainerStyles}> | ||
{separators} | ||
@@ -389,3 +402,3 @@ </View> | ||
// Default value is the rounded down - numbersContainers width divided by this.maxValue - 0 (number of options). | ||
let width = Math.floor(vw(this.widthPercentage) / (this.maxValue - 0)); | ||
let width = Math.floor(vw(this.widthPercentage) / (this.maxValue)); | ||
@@ -407,4 +420,8 @@ // If first TouchableHighlight, add extra width to account for the width of separatorLine. | ||
// Set width of number container | ||
let numberContainerStyles = Object.assign({}, styles.numberContainer); | ||
numberContainerStyles['width'] = vw(this.widthPercentage); | ||
return ( | ||
<View style={styles.numberContainer}> | ||
<View style={numberContainerStyles}> | ||
{numbers} | ||
@@ -472,3 +489,4 @@ </View> | ||
borderLeftColor: 'gainsboro', | ||
left: 2, | ||
// left: 2, | ||
left: vw(1) / 3, | ||
position: 'relative', | ||
@@ -504,3 +522,6 @@ }, | ||
zIndex: 20, | ||
elevation: 20 | ||
elevation: 20, | ||
left: -(vw(1) / 3), | ||
borderWidth: 1, | ||
borderColor: 'transparent' | ||
}, | ||
@@ -507,0 +528,0 @@ // |
@@ -8,3 +8,2 @@ /** | ||
* @param {String} buttonBorderColor - Optional. Sets border color of Slider's button. Can pass valid React Native color keywords, hexidecimal, rgb(), or rgba() values. Defaults to "gray". | ||
* @param {Number} minOffset - Optional. X-axis coordinates of left-edge of <StyledSliderPicker>. Component cannot be draggeed left past this point. | ||
* @param {Number} maxOffset - Optional. X-axis coordinates of right-edge of <StyledSliderPicker>. Component cannot be draggeed right past this point. | ||
@@ -38,3 +37,2 @@ * @param {Number} defaultValue - Optional. Default value the cursor will be placed in <StyledSliderPicker> on. | ||
this.defaultValue = this.props.defaultValue ? this.props.defaultValue : 5; | ||
this.minOffset = this.props.minOffset ? this.props.minOffset : vw(12.5); | ||
this.maxOffset = this.props.maxOffset ? this.props.maxOffset : vw(85); | ||
@@ -55,3 +53,3 @@ this.maxValue = this.props.maxValue ? this.props.maxValue : 10; | ||
this.offsetsMap.push({ | ||
offset: vw(85) * (i / this.maxValue), | ||
offset: this.maxOffset * (i / this.maxValue), | ||
value: i | ||
@@ -58,0 +56,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34557
717