Skip to content

Commit

Permalink
fix flexShrink support for VStack
Browse files Browse the repository at this point in the history
  • Loading branch information
lkzhao committed Apr 22, 2022
1 parent e03d369 commit e812864
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/UIComponent/Components/Layout/Stack/Stack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ extension Stack {
if let child = child as? Flexible, child.flexGrow > 0 {
let alignChild = child.alignSelf ?? alignItems
let addition = mainPerFlex * child.flexGrow
let mainReserved = addition + renderNodes[index].size.width
let mainReserved = addition + main(renderNodes[index].size)
let constraint = Constraint(
minSize: size(main: mainReserved, cross: (alignChild == .stretch) ? cross(constraint.maxSize) : 0),
maxSize: size(main: mainReserved, cross: cross(constraint.maxSize))
Expand All @@ -107,7 +107,7 @@ extension Stack {
for (index, child) in children.enumerated() {
if let child = child as? Flexible, child.flexShrink > 0 {
let alignChild = child.alignSelf ?? alignItems
let mainReserved = mainPerFlex * child.flexShrink + renderNodes[index].size.width
let mainReserved = mainPerFlex * child.flexShrink + main(renderNodes[index].size)
let constraint = Constraint(
minSize: size(main: mainReserved, cross: (alignChild == .stretch) ? cross(constraint.maxSize) : 0),
maxSize: size(main: mainReserved, cross: cross(constraint.maxSize))
Expand Down

0 comments on commit e812864

Please sign in to comment.