antd-mobile
Version:
基于 React 的移动设计规范实现
78 lines (58 loc) • 2.73 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = undefined;
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = require('react');
var React = _interopRequireWildcard(_react);
var _reactNative = require('react-native');
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var SliderAntm = function (_React$Component) {
(0, _inherits3["default"])(SliderAntm, _React$Component);
function SliderAntm() {
(0, _classCallCheck3["default"])(this, SliderAntm);
return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments));
}
SliderAntm.prototype.render = function render() {
var _props = this.props;
var defaultValue = _props.defaultValue;
var value = _props.value;
var min = _props.min;
var max = _props.max;
var step = _props.step;
var disabled = _props.disabled;
var onChange = _props.onChange;
var onAfterChange = _props.onAfterChange;
return React.createElement(
_reactNative.View,
null,
React.createElement(_reactNative.Slider, { value: defaultValue || value, minimumValue: min, maximumValue: max, step: step, minimumTrackTintColor: '#2db7f5', maximumTrackTintColor: '#ccc', disabled: disabled, onValueChange: onChange, onSlidingComplete: onAfterChange })
);
};
return SliderAntm;
}(React.Component);
exports["default"] = SliderAntm;
SliderAntm.propTypes = {
onChange: _react.PropTypes.func,
onAfterChange: _react.PropTypes.func,
defaultValue: _react.PropTypes.number,
value: _react.PropTypes.number,
step: _react.PropTypes.number,
min: _react.PropTypes.number,
max: _react.PropTypes.number,
disabled: _react.PropTypes.bool
};
SliderAntm.defaultProps = {
onChange: function onChange() {},
onAfterChange: function onAfterChange() {},
defaultValue: 0,
disabled: false
};
module.exports = exports['default'];
;