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

Action/Input Sheet Not Fully Dismissing #169

Open
matthewjamesr opened this issue Jan 17, 2024 · 5 comments
Open

Action/Input Sheet Not Fully Dismissing #169

matthewjamesr opened this issue Jan 17, 2024 · 5 comments

Comments

@matthewjamesr
Copy link

Hello,

I have implemented an action sheet visually dismisses, however, the invisible layer seems to remain active, rendering the UI unresponsive. Below is the relevant code.

ForEach(goals["daily"]!, id: \.id) { goal in
                        
                        VStack {
                            
                            HStack {
                                if (goal.id > 0) {
                                    Text(goal.type)
                                        .font(.system(size: 14, weight: .medium))
                                        .padding(.bottom, -5)
                                        .padding(.top)
                                } else {
                                    Text(goal.type)
                                        .font(.system(size: 14, weight: .medium))
                                        .padding(.bottom, -5)
                                }
                                
                                Spacer()
                                
                                if (goal.id > 0) {
                                    Text(String(goal.amount))
                                        .font(.system(size: 14, weight: .light))
                                        .padding(.top)
                                } else {
                                    Text(String(goal.amount))
                                        .font(.system(size: 14, weight: .light))
                                }
                            }
                            .padding(.bottom, 5)
                            
                            //Replace with loop of Goal types
                            
                            if goal.type == "Steps" {
                                ProgressView(value: Double(currentMetrics.steps), total: Double(goal.amount))
                                    .background(.black)
                                    .tint(currentMetrics.steps > goal.amount ? .cyan : .green)
                                    .cornerRadius(10)
                            } else if goal.type == "Active Minutes" {
                                ProgressView(value: Double(currentMetrics.activeMinutes), total: Double(goal.amount))
                                    .background(.black)
                                    .tint(currentMetrics.activeMinutes > goal.amount ? .cyan : .green)
                                    .cornerRadius(10)
                            } else if goal.type == "VO2 Max" {
                                ProgressView(value: Double(currentMetrics.vo2Max), total: Double(goal.amount))
                                    .background(.black)
                                    .tint(.green)
                                    .cornerRadius(10)
                            }
                            
                        }
                        .popup(isPresented: $showingPopup) {
                            //GoalPopup(goal: .constant(goal))
                            
                            VStack(spacing: 0) {
                                Text("Nickname")
                                    .foregroundColor(.black)
                                    .font(.system(size: 20, weight: .bold))
                                    .kerning(0.38)
                                
                                TextField("Nickname", text: .constant("dd"))
                                    .padding()
                                    .frame(height: 44)
                                    .background {
                                        RoundedRectangle(cornerRadius: 12)
                                            .stroke(Color(red: 1, green: 0.23, blue: 0.19), lineWidth: 0.5)
                                    }
                                    .padding(.top, 6)
                                
                                Button {
                                    showingPopup = false
                                } label: {
                                    Text("Save changes")
                                        .buttonStyle(.plain)
                                        .font(.system(size: 17))
                                        .frame(maxWidth: .infinity)
                                        .frame(height: 44)
                                        .background {
                                            RoundedRectangle(cornerRadius: 12)
                                                .fill(Color(red: 0.29, green: 0.38, blue: 1))
                                        }
                                }
                                .buttonStyle(.plain)
                                .foregroundColor(.white)
                                .padding(.top, 12)
                            }
                            .padding(16)
                            .background(Color.white.cornerRadius(18))
                            .padding(.horizontal, 8)
                            .padding(.bottom, 30)
                            
                        } customize: {
                            $0
                                .type(.toast)
                                .position(.bottom)
                                .closeOnTap(false)
                                .dragToDismiss(true)
                                .isOpaque(true)
                                .dismissCallback({
                                    showingPopup = false
                                })
                        }
                        .onTapGesture {
                            showingPopup = true
                        }
                    }
                    ```
@f3dm76
Copy link
Collaborator

f3dm76 commented Jan 17, 2024

Hey @matthewjamesr, this code is not compilable, please provide an isolated piece of code I can launch to fix the problem. Also please specify platform, ios and xcode versions. Have a nice day

@Xteda87
Copy link

Xteda87 commented Feb 5, 2024

Hi guys.

I came across the same error. On the simulator everything works and closes perfectly, but on a real device - after the message disappears the interface becomes unclickable

@matthewjamesr Have you found a solution? Maybe some combination of settings?

@f3dm76
Copy link
Collaborator

f3dm76 commented Mar 11, 2024

@Xteda87 @matthewjamesr guys, we cannot reproduce the issue. Using settings from your code - everything works as supposed to. Please provide a working example so we could help you

@GaneshManickam
Copy link

GaneshManickam commented Mar 15, 2024

@f3dm76
Even i'm facing the same issue. It can be easily reproducible when hide and show multiple popup back and forth. even able to reproducible on simulator.

Also getting this message on console:

Currently, only presenting a single sheet is supported.
The next sheet will be presented when the currently presented sheet gets dismissed.

@f3dm76
Copy link
Collaborator

f3dm76 commented May 6, 2024

@GaneshManickam, if you are getting this error ("Currently, only presenting a single sheet is supported."), then you are most likely using opaque popups, which are SwiftUIs fullscreen sheets under the hood - and only one of those can be displayed at a time. So you shouldn't be doing this with opaque popups. Anyway, I am not able to reproduce the issue with any kind of popups. Please provide a compilable minimal working example of the issue, so I can help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants