nuke-components
Advanced tools
Comparing version 0.2.25 to 0.2.26
@@ -15,2 +15,3 @@ # 开关切换 | ||
import BizPage from 'nuke-biz-page'; | ||
import Modal from 'nuke-modal'; | ||
@@ -21,8 +22,16 @@ | ||
super(); | ||
this.state = { | ||
advanced: false, | ||
}; | ||
} | ||
state = { | ||
c1: true, | ||
c2: false | ||
}; | ||
onValueChange(value){ | ||
this.setState({advanced:value}); | ||
setTimeout(()=>{ | ||
Modal.toast('对不起,您没有权限打开高级版~'); | ||
this.setState({advanced:false}) | ||
},2000); | ||
} | ||
render() { | ||
@@ -38,29 +47,20 @@ return ( | ||
</View> | ||
<View style={styles.cellItem}> | ||
<Text style={styles.cellTitle}>S</Text> | ||
<Switch size="small" /> | ||
</View> | ||
</View> | ||
<BizPage.Intro main="selected"></BizPage.Intro> | ||
<BizPage.Intro main="disabled"></BizPage.Intro> | ||
<View style={styles.row}> | ||
<View style={styles.cellItemSmall}> | ||
<Switch checked={true}/> | ||
<View style={styles.cellItem}> | ||
<Switch disabled checked={true}/> | ||
</View> | ||
<View style={styles.cellItemSmall}> | ||
<Switch size="small" checked={true}/> | ||
</View> | ||
</View> | ||
<BizPage.Intro main="disabled"></BizPage.Intro> | ||
<BizPage.Intro main="双向绑定用于某些逻辑处理"></BizPage.Intro> | ||
<View style={styles.row}> | ||
<View style={styles.cellItemSmall}> | ||
<Switch disabled checked={true}/> | ||
<View style={styles.cellItem}> | ||
<Text style={styles.cellTitle}>开启高级版</Text> | ||
<Switch checked={this.state.advanced} onValueChange={this.onValueChange.bind(this)} /> | ||
</View> | ||
<View style={styles.cellItemSmall}> | ||
<Switch disabled size="small" checked={true}/> | ||
</View> | ||
</View> | ||
@@ -78,11 +78,7 @@ </BizPage> | ||
cellItem:{ | ||
width:'140rem', | ||
width:'170rem', | ||
height:'120rem', | ||
// justifyContent:'center' | ||
}, | ||
cellItemSmall:{ | ||
width:'140rem', | ||
height:'75rem', | ||
// justifyContent:'center' | ||
}, | ||
cellTitle:{ | ||
@@ -89,0 +85,0 @@ marginLeft:'10rem', |
@@ -58,2 +58,6 @@ # 输入框 | ||
</View> | ||
<BizPage.Intro sub="number"></BizPage.Intro> | ||
<View style={styles.singleWrap}> | ||
<TextInput placeholder="number" type="number" style={styles.single} /> | ||
</View> | ||
<BizPage.Intro sub="time"></BizPage.Intro> | ||
@@ -60,0 +64,0 @@ <View style={styles.singleWrap}> |
# Changelog | ||
## 0.2.26 / 2017-05-11 | ||
* [[d1142d0](http://gitlab.alibaba-inc.com/nuke/components/commit/d1142d03874c9940d1696f4d27a77cd904f8ddcc)] - `fix` fix switch disabled bug,添加双向绑定demo | ||
## 0.2.25 / 2017-05-03 | ||
@@ -5,0 +9,0 @@ |
@@ -44,7 +44,2 @@ /* @jsx createElement */ | ||
// if ('indeterminate' in props) { | ||
// indeterminate = props.indeterminate; | ||
// } else { | ||
// indeterminate = props.defaultIndeterminate; | ||
// } | ||
_this.state = { | ||
@@ -62,20 +57,9 @@ checked: checked | ||
} | ||
// if ('indeterminate' in nextProps) { | ||
// this.setState({ indeterminate: nextProps.indeterminate}); | ||
// } | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.componentDidUpdate(); | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return nextState.checked !== this.state.checked; | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() {} | ||
// shouldComponentUpdate(nextProps, nextState) { | ||
// } | ||
}, { | ||
key: 'render', | ||
@@ -97,5 +81,7 @@ value: function render() { | ||
checked: checked, | ||
disabled: disabled, | ||
onChange: this.handleClick | ||
}; | ||
if (disabled) { | ||
nativeProps.disabled = disabled; | ||
} | ||
@@ -205,10 +191,3 @@ return (0, _rax.createElement)('switch', _extends({}, nativeProps, others)); | ||
// if (!('indeterminate' in this.props)) { | ||
// this.setState({ | ||
// indeterminate: false | ||
// }); | ||
onValueChange(checked, e); | ||
// } else { | ||
// onValueChange(checked, false, e); | ||
// } | ||
}; | ||
@@ -215,0 +194,0 @@ }; |
{ | ||
"name": "nuke-components", | ||
"version": "0.2.25", | ||
"version": "0.2.26", | ||
"description": "nuke原件库", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
@@ -20,7 +20,2 @@ /* @jsx createElement */ | ||
// if ('indeterminate' in props) { | ||
// indeterminate = props.indeterminate; | ||
// } else { | ||
// indeterminate = props.defaultIndeterminate; | ||
// } | ||
this.state = { | ||
@@ -41,3 +36,2 @@ checked:checked, | ||
componentWillReceiveProps(nextProps) { | ||
@@ -47,15 +41,7 @@ if ('checked' in nextProps) { | ||
} | ||
} | ||
// if ('indeterminate' in nextProps) { | ||
// this.setState({ indeterminate: nextProps.indeterminate}); | ||
// } | ||
shouldComponentUpdate(nextProps, nextState) { | ||
return nextState.checked !== this.state.checked | ||
} | ||
componentDidMount() { | ||
this.componentDidUpdate(); | ||
} | ||
componentDidUpdate() { | ||
} | ||
// shouldComponentUpdate(nextProps, nextState) { | ||
// } | ||
@@ -75,10 +61,4 @@ handleClick = (e) => { | ||
// if (!('indeterminate' in this.props)) { | ||
// this.setState({ | ||
// indeterminate: false | ||
// }); | ||
onValueChange(checked, e); | ||
// } else { | ||
// onValueChange(checked, false, e); | ||
// } | ||
}; | ||
@@ -97,5 +77,7 @@ | ||
checked: checked, | ||
disabled: disabled, | ||
onChange: this.handleClick | ||
}; | ||
if(disabled){ | ||
nativeProps.disabled = disabled; | ||
} | ||
@@ -102,0 +84,0 @@ return ( |
134555
2462