rn-range-slider
Advanced tools
Comparing version 1.2.6 to 1.2.7
39
index.js
@@ -5,18 +5,23 @@ import React, {PureComponent} from 'react'; | ||
const noop = () => {} | ||
const NativeRangeSlider = requireNativeComponent('RangeSlider'); | ||
class RangeSlider extends PureComponent { | ||
constructor(props) { | ||
super(props); | ||
this._unboxEvent = this._unboxEvent.bind(this); | ||
_handleValueChange = ({nativeEvent}) => { | ||
const { onValueChanged } = this.props | ||
onValueChanged && onValueChanged(nativeEvent.lowValue, nativeEvent.highValue, nativeEvent.fromUser); | ||
} | ||
_unboxEvent(event: Event) { | ||
if (!this.props.onValueChanged) { | ||
return; | ||
} | ||
const ne = event.nativeEvent; | ||
this.props.onValueChanged(ne.lowValue, ne.highValue, ne.fromUser); | ||
_handleTouchStart = ({nativeEvent}) => { | ||
const { onTouchStart } = this.props; | ||
onTouchStart && onTouchStart(); | ||
} | ||
_handleTouchEnd = ({nativeEvent}) => { | ||
const { onTouchEnd } = this.props; | ||
onTouchEnd && onTouchEnd(); | ||
} | ||
render() { | ||
@@ -32,5 +37,7 @@ let { initialHighValue, initialLowValue, min, max } = this.props; | ||
return <NativeRangeSlider | ||
{...sliderProps} | ||
ref={component => this._slider = component} | ||
onValueChanged={this._unboxEvent} | ||
{...sliderProps} | ||
ref={component => this._slider = component} | ||
onValueChanged={this._handleValueChange} | ||
onTouchStart={this._handleTouchStart} | ||
onTouchEnd={this._handleTouchEnd} | ||
/> | ||
@@ -74,2 +81,5 @@ } | ||
labelBorderColor: PropTypes.string, | ||
onTouchStart: PropTypes.func, | ||
onTouchEnd: PropTypes.func, | ||
onValueChanged: PropTypes.func, | ||
} | ||
@@ -101,4 +111,7 @@ | ||
labelBorderColor: '#d13e85', | ||
onTouchStart: noop, | ||
onTouchEnd: noop, | ||
onValueChanged: noop, | ||
} | ||
export default RangeSlider | ||
export default RangeSlider |
{ | ||
"name": "rn-range-slider", | ||
"version": "1.2.6", | ||
"version": "1.2.7", | ||
"author": "Tigran Sahakyan <mail.of.tigran@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "React Native Range Slider for Android and iOS", |
@@ -123,4 +123,8 @@ # RangeSlider | ||
| onValueChanged | A callback to be called when value was changed.<br/>**fromUser** parameter is true if the value was changed because of user's interaction (not by calling **setLowValue** or **setHighValue** methods). Just like android's [OnSeekbarChangeListener](https://developer.android.com/reference/android/widget/SeekBar.OnSeekBarChangeListener). | lowValue: number<br/><br/>highValue: number<br/><br/>fromUser: boolean | | ||
| onTouchStart | Nothing to explain I think :) | - | | ||
| onTouchEnd | Nothing to explain here too | - | | ||
## Known issues | ||
* Label's corner radius is not working on iOS | ||
* Problems with integration of react-native 0.60+ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
101
130
958668
26