Skip to content

Commit

Permalink
feat(alita-core wx-react-native): 微信基础样式移除在page.wxss定义,防止对直接使用微信组件的影响
Browse files Browse the repository at this point in the history
affects: @areslabs/alita-core, @areslabs/wx-react-native
  • Loading branch information
ykforerlang committed Feb 17, 2020
1 parent ffbe802 commit 5ce1f7b
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/alita-core/mptemp/compCommon.wxss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.view {
.view, .image {
display: flex;
flex-grow: 0;
flex-shrink: 0;
Expand Down
8 changes: 0 additions & 8 deletions packages/alita-core/mptemp/pageCommon.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,9 @@ page {
line-height: 1.2;
overflow: hidden;
background-color: #e9e9e9;
min-width: 0;
min-height: 0;
}

/*小程序base组件*/
page, view, image, scroll-view {
display: flex;
flex-direction: column;
position: relative;
box-sizing: border-box;
border: 0 solid;
min-width: 0;
min-height: 0;
}
11 changes: 10 additions & 1 deletion packages/alita-core/src/tran/classNameHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@ export default function classNameHandler (ast,info) {
if (path.type === 'JSXOpeningElement'
&& path.node.name.name === 'image'
) {
// image 不支持包裹元素了,so, do nothing!
const attris = path.node.attributes
const origs = (attris.filter(item => item.type === 'JSXAttribute' && item.name.name === 'original'))

if (origs.length === 0) {
return
}

attris.push(
t.jsxAttribute(t.jsxIdentifier('class'), t.stringLiteral('image'))
)
}

}
Expand Down
25 changes: 14 additions & 11 deletions packages/wx-react-native/wxComponents/WXButton/index.wxss
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
.container{
display: flex;
flex:1;
text-align: center;
color:#0c42FD;
margin:0;
font-size: 18px;
padding: 8px;
line-height: 1.2;
.container {
display: flex;
flex-direction: column;
box-sizing: border-box;
flex: 1;
text-align: center;
color: #0c42FD;
margin: 0;
font-size: 18px;
padding: 8px;
line-height: 1.2;
position: relative;
}

.hc{
opacity: 0.2;
.hc {
opacity: 0.2;
}
11 changes: 11 additions & 0 deletions packages/wx-react-native/wxComponents/WXFlatList/index.wxss
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
@import '../common.wxss';


view, scroll-view {
display: flex;
flex-direction: column;
position: relative;
box-sizing: border-box;
border: 0 solid;
min-width: 0;
min-height: 0;
}

9 changes: 9 additions & 0 deletions packages/wx-react-native/wxComponents/WXScrollView/index.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
view, scroll-view {
display: flex;
flex-direction: column;
position: relative;
box-sizing: border-box;
border: 0 solid;
min-width: 0;
min-height: 0;
}
12 changes: 11 additions & 1 deletion packages/wx-react-native/wxComponents/WXSectionList/index.wxss
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
@import '../common.wxss';
@import '../common.wxss';

view, scroll-view {
display: flex;
flex-direction: column;
position: relative;
box-sizing: border-box;
border: 0 solid;
min-width: 0;
min-height: 0;
}

0 comments on commit 5ce1f7b

Please sign in to comment.