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

Layout breaking in iOS 16.4 #45

Closed
pacosw1 opened this issue Apr 5, 2023 · 7 comments
Closed

Layout breaking in iOS 16.4 #45

pacosw1 opened this issue Apr 5, 2023 · 7 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@pacosw1
Copy link

pacosw1 commented Apr 5, 2023

Describe the bug
The layout breaks in the new iOS version 16.4.
On the first render, the layout is rendered vertically instead of horizontally, and goes back to horizontal on interaction.

To Reproduce
Steps to reproduce the behavior:
Make any component with WrappingHStack on iOS 16.4 (bug only in this version)

Expected behavior
It should always be horizontal

Screenshots
If applicable, add screenshots to help explain your problem.

Context:
Simulator Screenshot - iPhone 14 Pro - 2023-04-05 at 09 16 54
Simulator Screenshot - iPhone 14 Pro - 2023-04-05 at 09 16 58

  • WrappingHStack version: [e.g. 2.2.0]
  • Model: [e.g. iPhone 14 Pro]
  • OS: [16.4]
@pacosw1 pacosw1 added bug Something isn't working help wanted Extra attention is needed labels Apr 5, 2023
@geraldvoit
Copy link

Same issue for me.

@softshipper
Copy link

Dear all,
I have also the same issue. The following code:

struct InterestView: View {
    @Environment(\.managedObjectContext) private var managedObjectContext
    @FetchRequest(entity: InterestEntity.entity(), sortDescriptors: []) private var items: FetchedResults<InterestEntity>
    
    var body: some View {
        NavigationStack {
            VStack {
                WrappingHStack(items, id: \.self) { item in
                    if let tag = item.tag {
                        InterestTag(text: tag)
                    }
                }
                .padding()
                Spacer()
            }.navigationTitle("interest")
                .toolbar {
                    NavigationLink {
                        SearchView()
                    } label: {
                        NavigationText(label: "search", icon: "magnifyingglass.circle")
                    }
                    NavigationLink("edit") {
                        EditView()
                    }
                }
        }
    }
}

shows the following output:

image

Would be very happy if someone could help.

Best regards

@timothyeggers
Copy link

timothyeggers commented May 9, 2023

Seems to be if its wrapped in a NavigationStack for me. I don't have a workaround...

EDIT: I found a workaround - but I"m not sure if it's permanent! I commented out the NavigationStack, compiled it, then uncommented the stack, compiled. It fixed it. I have no idea why.

@freddokresna
Copy link

freddokresna commented May 12, 2023

same like issue here #26

i just got this problem too,

hope my temporary solution can help others , who use this library

just add some refresh on view with dispatch

DispatchQueue.background(delay: 3.0, background: {
                            Task {
                                refresh.toggle() 
                           print("Reload view ( bug )")
                            }
                        }, completion: {
                           print("Complete force reload")
                        })

however this was a workaround, the apps looks glitching , but make the layout working fine again

@freddokresna
Copy link


extension DispatchQueue {

    static func background(delay: Double = 0.0, background: (() -> Void)? = nil, completion: (() -> Void)? = nil) {
        DispatchQueue.global(qos: .background).async {
            background?()
            if let completion = completion {
                DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: {
                    completion()
                })
            }
        }
    }

}

in case some of you want the dispatchqueue extensions

@dkk
Copy link
Owner

dkk commented May 24, 2023

Seems to work correctly. Try version 2.2.10. If it doesn't work for you, post a minimal example. The only code on this thread contains objects that are not avaliable.

@dkk dkk closed this as completed May 24, 2023
@softshipper
Copy link

Thanks a lot.

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

6 participants