Fixes #1119
parent
cee3fb25ad
commit
52f6c4adab
|
@ -16,6 +16,7 @@ const factory = (Thumb) => {
|
||||||
onBlur: PropTypes.func,
|
onBlur: PropTypes.func,
|
||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
onFocus: PropTypes.func,
|
onFocus: PropTypes.func,
|
||||||
|
ripple: PropTypes.bool,
|
||||||
theme: PropTypes.shape({
|
theme: PropTypes.shape({
|
||||||
disabled: PropTypes.string,
|
disabled: PropTypes.string,
|
||||||
field: PropTypes.string,
|
field: PropTypes.string,
|
||||||
|
@ -50,7 +51,7 @@ const factory = (Thumb) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { className, checked, disabled, onChange, theme, ...others } = this.props; //eslint-disable-line no-unused-vars
|
const { className, checked, ripple, disabled, onChange, theme, ...others } = this.props; //eslint-disable-line no-unused-vars
|
||||||
const _className = classnames(theme[disabled ? 'disabled' : 'field'], className);
|
const _className = classnames(theme[disabled ? 'disabled' : 'field'], className);
|
||||||
return (
|
return (
|
||||||
<label data-react-toolbox='switch' className={_className}>
|
<label data-react-toolbox='switch' className={_className}>
|
||||||
|
@ -64,7 +65,7 @@ const factory = (Thumb) => {
|
||||||
type='checkbox'
|
type='checkbox'
|
||||||
/>
|
/>
|
||||||
<span className={theme[checked ? 'on' : 'off']}>
|
<span className={theme[checked ? 'on' : 'off']}>
|
||||||
<Thumb disabled={this.props.disabled} theme={theme} />
|
<Thumb disabled={this.props.disabled} theme={theme} ripple={ripple} />
|
||||||
</span>
|
</span>
|
||||||
{this.props.label ? <span className={theme.text}>{this.props.label}</span> : null}
|
{this.props.label ? <span className={theme.text}>{this.props.label}</span> : null}
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -56,6 +56,7 @@ This component can be styled by context providing a theme with the key `RTSwitch
|
||||||
| `onBlur` | `Function` | | Callback function that is fired when when the switch is blurred.|
|
| `onBlur` | `Function` | | Callback function that is fired when when the switch is blurred.|
|
||||||
| `onChange` | `Function` | | Callback function that is fired when the component's value changes.|
|
| `onChange` | `Function` | | Callback function that is fired when the component's value changes.|
|
||||||
| `onFocus` | `Function` | | Callback function that is fired when the switch is focused.|
|
| `onFocus` | `Function` | | Callback function that is fired when the switch is focused.|
|
||||||
|
| `ripple` | `Boolean` | | If true, the ripple effect will be disabled.|
|
||||||
|
|
||||||
## Theme
|
## Theme
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue