mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 17:54:48 +00:00
added property to sliderIOS to be able to disable it
Summary: added a new property named 'disable' to SliderIOS this property prevents the user from being able to slide the slider Closes https://github.com/facebook/react-native/pull/3730 Reviewed By: svcscm Differential Revision: D2590154 Pulled By: javache fb-gh-sync-id: b8a9c82c1b05eb813d9b81180cb1083b3f1852ac
This commit is contained in:
parent
8185b203be
commit
7d4f5a5c47
@ -63,6 +63,12 @@ var SliderIOS = React.createClass({
|
||||
*/
|
||||
maximumTrackTintColor: PropTypes.string,
|
||||
|
||||
/**
|
||||
* If true the user won't be able to move the slider.
|
||||
* Default value is false.
|
||||
*/
|
||||
disabled: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* Callback continuously called while the user is dragging the slider.
|
||||
*/
|
||||
@ -86,6 +92,12 @@ var SliderIOS = React.createClass({
|
||||
}
|
||||
},
|
||||
|
||||
getDefaultProps: function() : any {
|
||||
return {
|
||||
disabled: false,
|
||||
};
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<RCTSlider
|
||||
@ -95,6 +107,7 @@ var SliderIOS = React.createClass({
|
||||
minimumValue={this.props.minimumValue}
|
||||
minimumTrackTintColor={this.props.minimumTrackTintColor}
|
||||
maximumTrackTintColor={this.props.maximumTrackTintColor}
|
||||
disabled={this.props.disabled}
|
||||
onChange={this._onValueChange}
|
||||
/>
|
||||
);
|
||||
|
@ -54,5 +54,13 @@ RCT_EXPORT_VIEW_PROPERTY(maximumValue, float);
|
||||
RCT_EXPORT_VIEW_PROPERTY(minimumTrackTintColor, UIColor);
|
||||
RCT_EXPORT_VIEW_PROPERTY(maximumTrackTintColor, UIColor);
|
||||
RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock);
|
||||
RCT_CUSTOM_VIEW_PROPERTY(disabled, BOOL, RCTSlider)
|
||||
{
|
||||
if (json) {
|
||||
view.enabled = !([RCTConvert BOOL:json]);
|
||||
} else {
|
||||
view.enabled = defaultView.enabled;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
x
Reference in New Issue
Block a user