facebook / yoga

Yoga is an embeddable layout engine targeting web standards.
https://yogalayout.dev/
MIT License
17.25k stars 1.42k forks source link

3.1.0 BUG: The change in the UILabel text affects the horizontal width calculation!!! #1676

Closed CtrlJone closed 1 month ago

CtrlJone commented 3 months ago

Report

Issues and Steps to Reproduce

I integrated version 3.1.0 using Swift’s DSL approach and found that when the text changes width, its compression behavior is not functioning as expected. In version 3.0.4, it works normally. Could you please let me know what changes were made?

Expected Behavior

When the text of gainLabel changes, the width of dashLineView should adjust accordingly, so the padding of contentView should be effective.

Actual Behavior

After switching to version 3.1.0, when the text of gainLabel changes, the width of dashLineView only increases and does not decrease. This causes gainLabel to exceed the width of contentView, making the padding of contentView ineffective.

Link to Code

contentView.builder {
    HStack(mainAxis: .spaceAround, crossAxis: .center) {
        titleLabel
        dashLineView.marginHorizontal(8).flexHeight(1).grow(1)
        gainLabel
    }.flex(1)
}.padding(8).layoutDirection(.auto)

When applicable, use this fiddle to post a web repro.

NickGerleman commented 3 months ago

@CtrlJone could you provide a reproducible example for this, and visual results?

The only thing I could think of, without knowing how this is being used, is a bugfix where justify-content: space-around will no longer incorrectly remove padding or other inflexible minimums on overflow.

CtrlJone commented 3 months ago

Of course , this is my demo @NickGerleman YogaDemo.zip