Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't respect Group view #22

Open
au5ton opened this issue May 19, 2022 · 0 comments
Open

Doesn't respect Group view #22

au5ton opened this issue May 19, 2022 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@au5ton
Copy link

au5ton commented May 19, 2022

Describe the bug
WrappingHStack treats the Group view as one view instead of its children.

To Reproduce
Steps to reproduce the behavior:

// Code to reproduce bug
WrappingHStack {
  Group {
    Text("\(Image(systemName: "bag"))  Limit 1")
      .padding(.top, 5)
      .border(.red)
    Text("\(Image(systemName: "gearshape.2"))  Automatically used")
      .padding(.top, 5)
      .border(.red)
    Text("\(Image(systemName: "exclamationmark.circle"))  Sold out")
      .foregroundColor(Color.red)
      .padding(.top, 5)
      .border(.red)
  }
  .font(.system(size: 14, weight: .semibold))
  .foregroundColor(.secondary)
  .lineLimit(1)
  .border(.blue)
}

Spacer()

// Workaround (not bugged)
WrappingHStack(alignment: .trailing) {
  Text("\(Image(systemName: "bag"))  Limit 1")
    .padding(.top, 5)
    .border(.red)
  Text("\(Image(systemName: "gearshape.2"))  Automatically used")
    .padding(.top, 5)
    .border(.red)
  Text("\(Image(systemName: "exclamationmark.circle"))  Sold out")
    .foregroundColor(Color.red)
    .padding(.top, 5)
    .border(.red)
}
.font(.system(size: 14, weight: .semibold))
.foregroundColor(.secondary)
.lineLimit(1)
.border(.blue)

Expected behavior
WrappingHStack would treat individual Text views as separate elements and provide spacing between them.

Screenshots
Screenshot of code above:

Simulator Screen Shot - iPhone SE (2nd generation) - 2022-05-19 at 17 16 11 copy

Context:

  • WrappingHStack version: 2.2.1
  • Model: iPhone SE (2020) (simulator)
  • OS: iOS15.2

Additional context

I understand that is a very quirky and specific edge case, but I thought I should report it just in case. I really wish Apple provided a native view for this. Coming from a web background, it seems really odd that iOS doesn't have something as comprehensive as CSS's flexbox.

Thank you for making this project! This package is such a lifesaver.

@au5ton au5ton added bug Something isn't working help wanted Extra attention is needed labels May 19, 2022
@dkk dkk removed their assignment Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants