Comparing version 1.0.9 to 2.0.0
# Mask 遮罩层 Demo | ||
- order: 1 | ||
* order: 1 | ||
@@ -9,6 +9,5 @@ Mask 模拟浮层效果 | ||
````js | ||
```js | ||
/** @jsx createElement */ | ||
import {createElement, Component,render} from 'rax'; | ||
import { createElement, Component, render } from 'rax'; | ||
import Input from 'nuke-input'; | ||
@@ -22,131 +21,154 @@ import View from 'nuke-view'; | ||
import Page from 'nuke-page'; | ||
const {isWeb} =Env; | ||
const { isWeb } = Env; | ||
let App = class NukeDemoIndex extends Component { | ||
constructor() { | ||
super(); | ||
this.GroupFruit = [ | ||
{value: 'zj', label: '浙江'}, | ||
{value: 'ah', label: '安徽'}, | ||
{value: 'sh', label: '上海'} | ||
]; | ||
this.state = { | ||
fruitChecked:['ah'], | ||
} | ||
} | ||
showMask(){ | ||
this.refs.myMask.show(); | ||
} | ||
hideMask(){ | ||
this.refs.myMask.hide(); | ||
} | ||
constructor() { | ||
super(); | ||
this.GroupFruit = [ | ||
{ value: 'zj', label: '浙江' }, | ||
{ value: 'ah', label: '安徽' }, | ||
{ value: 'sh', label: '上海' } | ||
]; | ||
this.state = { | ||
fruitChecked: ['ah'] | ||
}; | ||
} | ||
showMask() { | ||
this.refs.myMask.show(); | ||
} | ||
hideMask() { | ||
this.refs.myMask.hide(); | ||
} | ||
onChange =(value) =>{ | ||
onChange = value => { | ||
this.setState({ | ||
fruitChecked: value | ||
}); | ||
}; | ||
render() { | ||
return ( | ||
<Page title="Mask"> | ||
<Page.Intro main="浮层中嵌入简易表单操作" /> | ||
<View style={styles.result}> | ||
{this.state.fruitChecked ? ( | ||
<Text style={styles.resultText}> | ||
已选择: {this.state.fruitChecked.join(',')} | ||
</Text> | ||
) : null} | ||
</View> | ||
<Button type="primary" onPress={e => this.showMask()}> | ||
打开浮层(空白区域不能关闭) | ||
</Button> | ||
<Mask | ||
defaultVisible={false} | ||
noPress={true} | ||
ref="myMask" | ||
animate={true} | ||
style={styles.mask} | ||
contentStyle={styles.body} | ||
> | ||
<View style={styles.head}> | ||
<Text style={styles.textHead}>选择区域</Text> | ||
</View> | ||
<View style={styles.topicsWrap}> | ||
<Checkbox.Group | ||
value={this.state.fruitChecked} | ||
onChange={this.onChange} | ||
size="small" | ||
dataSource={this.GroupFruit} | ||
style={{ marginRight: 10 }} | ||
/> | ||
</View> | ||
<View style={styles.footer}> | ||
<Button | ||
rect | ||
block | ||
style={styles.dlgBtn} | ||
type="primary" | ||
size="large" | ||
onPress={() => this.hideMask()} | ||
> | ||
确定 | ||
</Button> | ||
</View> | ||
</Mask> | ||
</Page> | ||
); | ||
} | ||
}; | ||
const styles = { | ||
textarea: { | ||
// position:'absolute' | ||
width: '600rem', | ||
height: '200rem', | ||
borderWidth: '1rem', | ||
borderStyle: 'solid', | ||
borderColor: '#cccccc' | ||
}, | ||
mask: { | ||
flex: 1, | ||
backgroundColor: 'rgba(0,0,0,0.7)', | ||
justifyContent: 'flex-end' | ||
}, | ||
this.setState({ | ||
fruitChecked:value | ||
}) | ||
} | ||
render() { | ||
return ( | ||
<Page title="Mask"> | ||
<Page.Intro main="浮层中嵌入简易表单操作"></Page.Intro> | ||
<View style={styles.result}> | ||
{this.state.fruitChecked ? <Text style={styles.resultText}>已选择: {this.state.fruitChecked.join(',')}</Text> :null} | ||
</View> | ||
<Button type="primary" onPress={(e)=>this.showMask()}>打开浮层(空白区域不能关闭)</Button> | ||
<Mask defaultVisible={false} ref="myMask" animate={true} style={styles.mask} contentStyle={styles.body}> | ||
body: { | ||
width: '750rem', | ||
height: '468rem', | ||
borderRadius: '8rem', | ||
borderBottomStyle: 'solid', | ||
borderBottomWidth: 1, | ||
borderBottomColor: 'red', | ||
<View style={styles.head}><Text style={styles.textHead}>选择区域</Text></View> | ||
<View style={styles.topicsWrap}> | ||
<Checkbox.Group value={this.state.fruitChecked} onChange={ this.onChange } size="small" dataSource={ this.GroupFruit } style={{marginRight:10}}></Checkbox.Group> | ||
</View> | ||
<View style={styles.footer}> | ||
<Button rect block style={styles.dlgBtn} type="primary" size="large" onPress={()=>this.hideMask()}>确定</Button> | ||
paddingTop: 30, | ||
borderRadius: '8rem', | ||
backgroundColor: '#ffffff' | ||
}, | ||
head: { | ||
height: 60, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
borderBottomColor: '#eeeeee', | ||
borderBottomStyle: 'solid', | ||
borderBottomWidth: '1rem' | ||
}, | ||
textHead: { | ||
color: '#3d4145', | ||
fontSize: 32 | ||
}, | ||
topics: { | ||
paddingLeft: 40, | ||
paddingRight: 40, | ||
flexDirection: 'row' | ||
}, | ||
text: { | ||
fontSize: '28rem', | ||
padding: '10rem', | ||
color: '#3089dc', | ||
borderColor: '#3089dc', | ||
borderStyle: 'solid', | ||
borderWidth: '1rem', | ||
marginRight: '20rem' | ||
}, | ||
footer: { | ||
flexDirection: 'row', | ||
</View> | ||
</Mask> | ||
</Page> | ||
); | ||
} | ||
} | ||
const styles={ | ||
textarea:{ | ||
// position:'absolute' | ||
width: '600rem', | ||
height: '200rem', | ||
borderWidth:'1rem', | ||
borderStyle:'solid', | ||
borderColor:'#cccccc' | ||
}, | ||
mask:{ | ||
flex:1, | ||
backgroundColor:'rgba(0,0,0,0.7)', | ||
justifyContent: 'flex-end', | ||
}, | ||
body: { | ||
width: '750rem', | ||
height: '468rem', | ||
borderRadius:'8rem', | ||
borderBottomStyle:'solid', | ||
borderBottomWidth:1, | ||
borderBottomColor:'red', | ||
paddingTop:30, | ||
borderRadius:'8rem', | ||
backgroundColor: '#ffffff', | ||
}, | ||
head:{ | ||
height: 60, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
borderBottomColor:'#eeeeee', | ||
borderBottomStyle:'solid', | ||
borderBottomWidth:'1rem', | ||
}, | ||
textHead:{ | ||
color:'#3d4145', | ||
fontSize:32, | ||
}, | ||
topics:{ | ||
paddingLeft:40, | ||
paddingRight:40, | ||
flexDirection:'row', | ||
}, | ||
text:{ | ||
fontSize:'28rem', | ||
padding:'10rem', | ||
color:'#3089dc', | ||
borderColor:'#3089dc', | ||
borderStyle:'solid', | ||
borderWidth:'1rem', | ||
marginRight:'20rem' | ||
}, | ||
footer: { | ||
flexDirection:'row', | ||
alignItems: 'center', | ||
justifyContent: 'flex-end', | ||
height: '94rem' | ||
}, | ||
dlgBtn:{ | ||
flex:1, | ||
}, | ||
result : { | ||
height:'480rem', | ||
margin:'30rem', | ||
padding:'10rem', | ||
backgroundColor:'#ffffff', | ||
justifyContent:'center', | ||
alignItems:'center' | ||
}, | ||
resultText : { | ||
fontSize:'28rem' | ||
}, | ||
} | ||
render(<App/>); | ||
```` | ||
alignItems: 'center', | ||
justifyContent: 'flex-end', | ||
height: '94rem' | ||
}, | ||
dlgBtn: { | ||
flex: 1 | ||
}, | ||
result: { | ||
height: '480rem', | ||
margin: '30rem', | ||
padding: '10rem', | ||
backgroundColor: '#ffffff', | ||
justifyContent: 'center', | ||
alignItems: 'center' | ||
}, | ||
resultText: { | ||
fontSize: '28rem' | ||
} | ||
}; | ||
render(<App />); | ||
``` |
@@ -38,3 +38,3 @@ # Mask 遮罩层 Demo | ||
onShow(e){ | ||
console.log('onshow') | ||
console.log('onshowxxxx') | ||
} | ||
@@ -41,0 +41,0 @@ onHide(e){ |
# Changelog | ||
## 2.0.0 / 2018-03-26 | ||
* [[4e31573](http://gitlab.alibaba-inc.com/nuke/mask/commit/4e31573245aed8ad90dd7c385e16a1d6bf508a4c)] - `feat` update dependencies | ||
## 1.0.9 / 2017-12-27 | ||
@@ -5,0 +9,0 @@ |
@@ -127,3 +127,3 @@ 'use strict'; | ||
} | ||
}, 0); | ||
}, 10); | ||
} | ||
@@ -229,5 +229,19 @@ }, { | ||
onClick = _props4.onClick, | ||
others = _objectWithoutProperties(_props4, ['content', 'children', 'style', 'onVisibleChanged', 'onClick']); | ||
_props4$noPress = _props4.noPress, | ||
noPress = _props4$noPress === undefined ? false : _props4$noPress, | ||
others = _objectWithoutProperties(_props4, ['content', 'children', 'style', 'onVisibleChanged', 'onClick', 'noPress']); | ||
if (isWeex) { | ||
var nativeAttrs = _extends({}, others, { | ||
style: [appInfo.platform === 'iOS' ? styles.maskNativeIOS : {}, style], | ||
onClick: function onClick(e) { | ||
return _this5.maskPress(e); | ||
}, | ||
onVisibleChanged: function onVisibleChanged(e) { | ||
return _this5.change(e); | ||
} | ||
}); | ||
if (noPress) { | ||
delete nativeAttrs.onClick; | ||
} | ||
var maskWeex = visible ? (0, _rax.createElement)( | ||
@@ -238,12 +252,4 @@ 'mask', | ||
_this5.maskNode = (0, _rax.findDOMNode)(n); | ||
}, | ||
style: [appInfo.platform === 'iOS' ? styles.maskNativeIOS : {}, style] | ||
}, others, { | ||
onClick: function onClick(e) { | ||
return _this5.maskPress(e); | ||
}, | ||
onVisibleChanged: function onVisibleChanged(e) { | ||
return _this5.change(e); | ||
} | ||
}), | ||
}, nativeAttrs), | ||
this.getChildren() | ||
@@ -278,4 +284,4 @@ ) : null; | ||
width: 750, | ||
top: 0, | ||
left: 0, | ||
// top: 0, | ||
// left: 0, | ||
height: Math.round(screen.height / window.devicePixelRatio) + 'wx' | ||
@@ -282,0 +288,0 @@ }, |
{ | ||
"name": "nuke-mask", | ||
"version": "1.0.9", | ||
"version": "2.0.0", | ||
"description": "遮罩层", | ||
@@ -60,13 +60,13 @@ "main": "lib/index", | ||
"dependencies": { | ||
"nuke-dimensions": "^0.x.x", | ||
"nuke-env": "^1.x.x", | ||
"nuke-transition": "^1.x.x", | ||
"nuke-view": "^1.x.x" | ||
"nuke-dimensions": "^2.x.x", | ||
"nuke-env": "^2.x.x", | ||
"nuke-transition": "^2.x.x", | ||
"nuke-view": "^2.x.x" | ||
}, | ||
"devDependencies": { | ||
"nuke-button": "^1.x.x", | ||
"nuke-checkbox": "^1.x.x", | ||
"nuke-input": "^1.x.x", | ||
"nuke-page": "^1.x.x", | ||
"nuke-text": "^0.x.x" | ||
"nuke-button": "^2.x.x", | ||
"nuke-checkbox": "^2.x.x", | ||
"nuke-input": "^2.x.x", | ||
"nuke-page": "^2.x.x", | ||
"nuke-text": "^2.x.x" | ||
}, | ||
@@ -73,0 +73,0 @@ "publishConfig": { |
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
32761
8
347
+ Addednuke-dimensions@2.3.12(transitive)
+ Addednuke-env@2.3.12(transitive)
+ Addednuke-helper@2.3.12(transitive)
+ Addednuke-transition@2.3.12(transitive)
+ Addednuke-view@2.3.12(transitive)
- Removeddriver-browser@0.6.7(transitive)
- Removeddriver-server@0.6.5(transitive)
- Removeddriver-weex@0.6.5(transitive)
- Removednuke-dimensions@0.2.0(transitive)
- Removednuke-env@1.0.1(transitive)
- Removednuke-helper@0.0.11(transitive)
- Removednuke-transition@1.0.3(transitive)
- Removednuke-view@1.0.7(transitive)
- Removedrax@0.6.7(transitive)
- Removedrax-view@0.4.20(transitive)
- Removedstyle-unit@0.4.200.6.5(transitive)
- Removedua-parser-js@0.7.39(transitive)
- Removeduniversal-env@0.4.200.6.6(transitive)
Updatednuke-dimensions@^2.x.x
Updatednuke-env@^2.x.x
Updatednuke-transition@^2.x.x
Updatednuke-view@^2.x.x