nuke-components
Advanced tools
Comparing version 0.2.27 to 0.2.28
@@ -24,3 +24,9 @@ # 开关切换 | ||
advanced: false, | ||
disabled:true | ||
}; | ||
setTimeout(()=>{ | ||
this.setState({ | ||
disabled:false | ||
}) | ||
},4000) | ||
} | ||
@@ -37,2 +43,3 @@ | ||
render() { | ||
let disabledProps = this.state.disabled ? {disabled:this.state.disabled} : {}; | ||
return ( | ||
@@ -66,2 +73,11 @@ <BizPage title="Switch"> | ||
</View> | ||
<BizPage.Intro main="先 disabled 再 enabled"></BizPage.Intro> | ||
<View style={styles.row}> | ||
<View style={styles.cellItem}> | ||
<Text style={styles.cellTitle}>disabled:{this.state.disabled}</Text> | ||
<Switch {...disabledProps} /> | ||
</View> | ||
</View> | ||
</BizPage> | ||
@@ -78,3 +94,3 @@ ); | ||
cellItem:{ | ||
width:'170rem', | ||
width:'200rem', | ||
height:'120rem', | ||
@@ -81,0 +97,0 @@ // justifyContent:'center' |
# Changelog | ||
## 0.2.28 / 2017-05-15 | ||
* [[dd8a851](http://gitlab.alibaba-inc.com/nuke/components/commit/dd8a8512013b27c5b44ea47b45f2aaf7957b44c7)] - `fix` fix switch 1px h5 bug | ||
* [[1f5ce6e](http://gitlab.alibaba-inc.com/nuke/components/commit/1f5ce6ede323c7ba759e1c5a997dd38e2f74fe88)] - `fix` fix switch disabled bug | ||
## 0.2.27 / 2017-05-12 | ||
@@ -5,0 +10,0 @@ |
@@ -58,7 +58,2 @@ /* @jsx createElement */ | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return nextState.checked !== this.state.checked; | ||
} | ||
}, { | ||
key: 'render', | ||
@@ -68,3 +63,4 @@ value: function render() { | ||
style = _props.style, | ||
disabled = _props.disabled, | ||
_props$disabled = _props.disabled, | ||
disabled = _props$disabled === undefined ? false : _props$disabled, | ||
size = _props.size, | ||
@@ -80,8 +76,9 @@ onValueChange = _props.onValueChange, | ||
style: _extends({}, styles.initial, this.props.style), | ||
disabled: disabled, | ||
checked: checked, | ||
onChange: this.handleClick | ||
}; | ||
if (disabled) { | ||
nativeProps.disabled = disabled; | ||
} | ||
// if(disabled){ | ||
// nativeProps.disabled = disabled; | ||
// } | ||
@@ -97,3 +94,3 @@ return (0, _rax.createElement)('switch', _extends({}, nativeProps, others)); | ||
'span', | ||
_extends({ onClick: this.handleClick.bind(this), style: wraperStyle }, others), | ||
_extends({ onClick: this.handleClick.bind(this), style: wraperStyle }, others, { className: 'nuke-border-fix-1' }), | ||
(0, _rax.createElement)('small', { style: innerStyle }) | ||
@@ -118,3 +115,3 @@ ); | ||
borderColor: '#dfdfdf', | ||
borderWidth: '1px', | ||
borderWidth: '1rem', | ||
borderStyle: 'solid', | ||
@@ -180,3 +177,4 @@ WebkitUserSelect: 'none', | ||
var _props2 = _this2.props, | ||
disabled = _props2.disabled, | ||
_props2$disabled = _props2.disabled, | ||
disabled = _props2$disabled === undefined ? false : _props2$disabled, | ||
onValueChange = _props2.onValueChange; | ||
@@ -183,0 +181,0 @@ |
{ | ||
"name": "nuke-components", | ||
"version": "0.2.27", | ||
"version": "0.2.28", | ||
"description": "nuke原件库", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
@@ -41,9 +41,7 @@ /* @jsx createElement */ | ||
shouldComponentUpdate(nextProps, nextState) { | ||
return nextState.checked !== this.state.checked | ||
} | ||
handleClick = (e) => { | ||
const { disabled, onValueChange } = this.props; | ||
const { disabled = false, onValueChange } = this.props; | ||
if (disabled) { | ||
@@ -64,3 +62,3 @@ return null; | ||
render() { | ||
const { style,disabled,size,onValueChange, ...others} = this.props; | ||
const { style,disabled = false,size,onValueChange, ...others} = this.props; | ||
const { checked } = this.state; | ||
@@ -74,8 +72,9 @@ | ||
}, | ||
disabled:disabled, | ||
checked: checked, | ||
onChange: this.handleClick | ||
}; | ||
if(disabled){ | ||
nativeProps.disabled = disabled; | ||
} | ||
// if(disabled){ | ||
// nativeProps.disabled = disabled; | ||
// } | ||
@@ -97,3 +96,3 @@ return ( | ||
return ( | ||
<span onClick={this.handleClick.bind(this)} style={wraperStyle} {...others}> | ||
<span onClick={this.handleClick.bind(this)} style={wraperStyle} {...others} className="nuke-border-fix-1"> | ||
<small style={innerStyle}/> | ||
@@ -119,3 +118,3 @@ </span> | ||
borderColor: '#dfdfdf', | ||
borderWidth: '1px', | ||
borderWidth: '1rem', | ||
borderStyle: 'solid', | ||
@@ -122,0 +121,0 @@ WebkitUserSelect: 'none', |
160893
44
3020