Skip to content

Commit cc4618e

Browse files
committed
fix: 修复 align-items 丢失问题
1 parent 22f648a commit cc4618e

File tree

4 files changed

+35
-16
lines changed

4 files changed

+35
-16
lines changed

__test__/fixure/Mod.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
background: red url(https://img.alicdn.com/imgextra/i1/O1CN01QYQY2e1Q1QYQY2e1Q_!!6000000000000-2-tps-18-18.png) no-repeat center;
1515
flex: 2 2 10%;
1616
border-radius: 50%;
17+
align-items: flex-end;
1718
}
1819
.instruction {
1920
color:rgb(255,255,255);

__test__/index.spec.mjs.md

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Generated by [AVA](https://avajs.dev).
1616
display: "flex",␊
1717
flexOptions: {␊
1818
direction: FlexDirection.Column,␊
19-
justifyContent: FlexAlign.Center␊
19+
justifyContent: FlexAlign.Center,␊
20+
alignItems: ItemAlign.Start␊
2021
},␊
2122
gap: "8px",␊
2223
height: "50px",␊
@@ -114,7 +115,8 @@ Generated by [AVA](https://avajs.dev).
114115
borderWidth: "1px",␊
115116
display: "flex",␊
116117
flexOptions: {␊
117-
justifyContent: FlexAlign.SpaceBetween␊
118+
justifyContent: FlexAlign.SpaceBetween,␊
119+
alignItems: ItemAlign.Start␊
118120
},␊
119121
flexShrink: 0,␊
120122
gap: "-94px",␊
@@ -279,7 +281,9 @@ Generated by [AVA](https://avajs.dev).
279281
},␊
280282
flexBasis: "10%",␊
281283
flexGrow: 2,␊
282-
flexOptions: {},␊
284+
flexOptions: {␊
285+
alignItems: ItemAlign.End␊
286+
},␊
283287
flexShrink: 2,␊
284288
overflow: "hidden",␊
285289
textOverflow: "ellipsis",␊
@@ -298,7 +302,8 @@ Generated by [AVA](https://avajs.dev).
298302
display: "flex",␊
299303
flexOptions: {␊
300304
direction: FlexDirection.Column,␊
301-
justifyContent: FlexAlign.Center␊
305+
justifyContent: FlexAlign.Center,␊
306+
alignItems: ItemAlign.Start␊
302307
},␊
303308
flexShrink: 0,␊
304309
fontFamily: "Source Han Sans CN",␊
@@ -368,7 +373,9 @@ Generated by [AVA](https://avajs.dev).
368373
display: "inline-flex",␊
369374
flexBasis: "10%",␊
370375
flexGrow: 2,␊
371-
flexOptions: {},␊
376+
flexOptions: {␊
377+
alignItems: ItemAlign.End␊
378+
},␊
372379
flexShrink: 0,␊
373380
fontSize: "12px",␊
374381
lineHeight: "1",␊
@@ -419,7 +426,9 @@ Generated by [AVA](https://avajs.dev).
419426
display: "inline-flex",␊
420427
flexBasis: "10%",␊
421428
flexGrow: 2,␊
422-
flexOptions: {},␊
429+
flexOptions: {␊
430+
alignItems: ItemAlign.End␊
431+
},␊
423432
flexShrink: 0,␊
424433
fontSize: "12px",␊
425434
lineHeight: "1",␊
@@ -454,7 +463,8 @@ Generated by [AVA](https://avajs.dev).
454463
display: "flex",␊
455464
flexOptions: {␊
456465
direction: FlexDirection.Column,␊
457-
justifyContent: FlexAlign.Center␊
466+
justifyContent: FlexAlign.Center,␊
467+
alignItems: ItemAlign.Start␊
458468
},␊
459469
flexShrink: 0,␊
460470
fontFamily: "Source Han Sans CN",␊
@@ -533,7 +543,9 @@ Generated by [AVA](https://avajs.dev).
533543
display: "inline-flex",␊
534544
flexBasis: "10%",␊
535545
flexGrow: 2,␊
536-
flexOptions: {},␊
546+
flexOptions: {␊
547+
alignItems: ItemAlign.End␊
548+
},␊
537549
flexShrink: 0,␊
538550
fontSize: "12px",␊
539551
lineHeight: "1",␊
@@ -637,7 +649,8 @@ Generated by [AVA](https://avajs.dev).
637649
display: "flex",␊
638650
flexOptions: {␊
639651
direction: FlexDirection.Column,␊
640-
justifyContent: FlexAlign.Center␊
652+
justifyContent: FlexAlign.Center,␊
653+
alignItems: ItemAlign.Start␊
641654
},␊
642655
gap: "8px",␊
643656
height: "50px",␊
@@ -670,7 +683,9 @@ Generated by [AVA](https://avajs.dev).
670683
display: "inline-flex",␊
671684
flexBasis: "10%",␊
672685
flexGrow: 2,␊
673-
flexOptions: {},␊
686+
flexOptions: {␊
687+
alignItems: ItemAlign.End␊
688+
},␊
674689
flexShrink: 0,␊
675690
fontSize: "16px",␊
676691
lineHeight: "1",␊
@@ -706,7 +721,9 @@ Generated by [AVA](https://avajs.dev).
706721
display: "inline-flex",␊
707722
flexBasis: "10%",␊
708723
flexGrow: 2,␊
709-
flexOptions: {},␊
724+
flexOptions: {␊
725+
alignItems: ItemAlign.End␊
726+
},␊
710727
flexShrink: 0,␊
711728
fontSize: "12px",␊
712729
lineHeight: "1",␊
@@ -729,7 +746,8 @@ Generated by [AVA](https://avajs.dev).
729746
borderWidth: "1px",␊
730747
display: "flex",␊
731748
flexOptions: {␊
732-
justifyContent: FlexAlign.SpaceBetween␊
749+
justifyContent: FlexAlign.SpaceBetween,␊
750+
alignItems: ItemAlign.Start␊
733751
},␊
734752
flexShrink: 0,␊
735753
gap: "-94px",␊

__test__/index.spec.mjs.snap

33 Bytes
Binary file not shown.

src/style_transform/flex_options/item_align.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ impl From<&Property<'_>> for ItemAlign {
3838
Property::AlignItems(value, _) => match value {
3939
LNAlignItems::Stretch => ItemAlign::Stretch,
4040
LNAlignItems::SelfPosition { value, .. } => match value {
41-
SelfPosition::Start => ItemAlign::Start,
41+
SelfPosition::Start | SelfPosition::FlexStart => ItemAlign::Start,
4242
SelfPosition::Center => ItemAlign::Center,
43-
SelfPosition::End => ItemAlign::End,
43+
SelfPosition::End | SelfPosition::FlexEnd => ItemAlign::End,
4444
_ => ItemAlign::Ignore,
4545
},
4646
LNAlignItems::BaselinePosition(value) => match value {
@@ -52,9 +52,9 @@ impl From<&Property<'_>> for ItemAlign {
5252
Property::AlignSelf(value, _) => match value {
5353
LNAlignSelf::Auto => ItemAlign::Auto,
5454
LNAlignSelf::SelfPosition { value, .. } => match value {
55-
SelfPosition::Start => ItemAlign::Start,
55+
SelfPosition::Start | SelfPosition::FlexStart => ItemAlign::Start,
5656
SelfPosition::Center => ItemAlign::Center,
57-
SelfPosition::End => ItemAlign::End,
57+
SelfPosition::End | SelfPosition::FlexEnd => ItemAlign::End,
5858
_ => ItemAlign::Ignore,
5959
},
6060
LNAlignSelf::BaselinePosition(value) => match value {

0 commit comments

Comments
 (0)