Comparing version 1.0.3 to 1.0.4
@@ -19,43 +19,41 @@ # Mask 遮罩层 Demo | ||
let App = class NukeDemoIndex extends Component { | ||
constructor() { | ||
super(); | ||
this.state={ | ||
maskVisible:false | ||
} | ||
this.onShow=this.onShow.bind(this); | ||
this.onHide=this.onHide.bind(this); | ||
constructor() { | ||
super(); | ||
this.state={ | ||
maskVisible:false | ||
} | ||
this.onShow=this.onShow.bind(this); | ||
this.onHide=this.onHide.bind(this); | ||
} | ||
showMask(e){ | ||
//debugger; | ||
this.refs.myMask.show(); | ||
showMask(e){ | ||
console.log('clicked'); | ||
this.refs.myMask.show(); | ||
} | ||
onVisibleChanged=(e)=>{ | ||
} | ||
hideMask(e){ | ||
this.refs.myMask.hide(); | ||
} | ||
onShow(e){ | ||
console.log('onshow') | ||
} | ||
onHide(e){ | ||
console.log('onhide') | ||
} | ||
render() { | ||
return ( | ||
<Page title="Mask"> | ||
<Page.Intro main="普通用法"></Page.Intro> | ||
<Button type="primary" onPress={(e)=>this.showMask(e)}>打开浮层</Button> | ||
} | ||
onVisibleChanged=(e)=>{ | ||
// alert('trigger by android') | ||
} | ||
hideMask(e){ | ||
this.refs.myMask.hide(); | ||
} | ||
onShow(e){ | ||
console.log('onshow') | ||
} | ||
onHide(e){ | ||
console.log('onhide') | ||
} | ||
render() { | ||
return ( | ||
<Page title="Mask"> | ||
<Page.Intro main="普通用法"></Page.Intro> | ||
<Button type="primary" onPress={(e)=>this.showMask(e)}>打开浮层</Button> | ||
<Mask onShow={this.onShow} defaultVisible={false} onVisibleChanged={this.onVisibleChanged} ref="myMask" animate={false} style={styles.mask} maskClosable={true}> | ||
<View style={styles.dialogWrap}> | ||
<Text style={styles.text}>点击外层 mask 区域可关闭</Text> | ||
<Button type="primary" onPress={(e)=>this.hideMask(e)}>关闭</Button> | ||
</View> | ||
</Mask> | ||
<Mask onShow={this.onShow} defaultVisible={false} onVisibleChanged={this.onVisibleChanged} ref="myMask" animate={false} style={styles.mask} maskClosable={true}> | ||
<View style={styles.dialogWrap}> | ||
<Text style={styles.text}>点击空白区域可关闭</Text> | ||
<Button type="primary" onPress={(e)=>this.hideMask(e)}>点击按钮关闭</Button> | ||
</View> | ||
</Mask> | ||
</Page> | ||
); | ||
</Page> | ||
); | ||
} | ||
@@ -90,2 +88,3 @@ } | ||
marginBottom:20, | ||
fontSize:32 | ||
} | ||
@@ -92,0 +91,0 @@ } |
# Changelog | ||
## 1.0.4 / 2017-11-23 | ||
* [[90a0503](http://gitlab.alibaba-inc.com/nuke/mask/commit/90a050337b6c8b837e1bef76bc75536f6cbbd017)] - `fix` fix logic bugs | ||
## 1.0.3 / 2017-11-07 | ||
@@ -5,0 +9,0 @@ |
@@ -59,4 +59,3 @@ 'use strict'; | ||
_this.state = { | ||
visible: visible, | ||
styleOpacity: 0 | ||
visible: visible | ||
}; | ||
@@ -71,3 +70,3 @@ return _this; | ||
this.initFlag = true; | ||
return nextProps.style !== this.props.style || nextState.visible !== this.state.visible || nextState.styleOpacity !== this.state.styleOpacity; | ||
return nextProps.style !== this.props.style || nextState.visible !== this.state.visible; | ||
} | ||
@@ -83,5 +82,5 @@ return true; | ||
} else { | ||
this.setState({ | ||
styleOpacity: 1 | ||
}); | ||
// this.setState({ | ||
// styleOpacity: 1 | ||
// }); | ||
} | ||
@@ -156,3 +155,2 @@ } | ||
this.setState({ | ||
styleOpacity: 1, | ||
visible: false | ||
@@ -171,4 +169,5 @@ }); | ||
}, { | ||
key: 'empty', | ||
value: function empty(e) { | ||
key: 'emptyEvent', | ||
value: function emptyEvent(e) { | ||
// EmptyEvent consumes event in android, so it would not be bubbled to mask press. | ||
if (isWeb) { | ||
@@ -191,3 +190,5 @@ e.stopPropagation(); | ||
return (0, _rax.cloneElement)(children, { | ||
onPress: function onPress(e) {} | ||
onClick: function onClick(e) { | ||
_this4.emptyEvent(e); | ||
} | ||
}); | ||
@@ -197,3 +198,5 @@ } | ||
return (0, _rax.cloneElement)(children[0], { | ||
onPress: function onPress(e) {} | ||
onClick: function onClick(e) { | ||
_this4.emptyEvent(e); | ||
} | ||
}); | ||
@@ -204,3 +207,3 @@ } else { | ||
{ style: contentStyle, x: 'autowrap', onClick: function onClick(e) { | ||
return _this4.empty(e); | ||
return _this4.emptyEvent(e); | ||
} }, | ||
@@ -236,3 +239,3 @@ children | ||
}, | ||
style: [styles.transparent, { opacity: this.state.styleOpacity }, style] | ||
style: [style] | ||
}, others, { | ||
@@ -256,3 +259,3 @@ onClick: function onClick(e) { | ||
}, | ||
style: [styles.maskPosition, { opacity: this.state.styleOpacity }, style], | ||
style: [styles.maskPosition, style], | ||
onClick: function onClick(e) { | ||
@@ -259,0 +262,0 @@ return _this5.maskPress(e); |
{ | ||
"name": "nuke-mask", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "遮罩层", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
326
28966