PopupView icon indicating copy to clipboard operation
PopupView copied to clipboard

Action/Input Sheet Not Fully Dismissing

Open matthewjamesr opened this issue 2 years ago • 5 comments

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
                        }
                    }
                    ```

matthewjamesr avatar Jan 17 '24 05:01 matthewjamesr

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

f3dm76 avatar Jan 17 '24 05:01 f3dm76

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?

Xteda87 avatar Feb 05 '24 19:02 Xteda87

@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

f3dm76 avatar Mar 11 '24 08:03 f3dm76

@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.

GaneshManickam avatar Mar 15 '24 12:03 GaneshManickam

@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.

f3dm76 avatar May 06 '24 10:05 f3dm76

It's been a while, so I'll close this one for now. Please feel free to reopen if you are still having the issue. Please be sure to attach minimal compilable reproducible example. Have a nice day!

f3dm76 avatar Jun 18 '24 08:06 f3dm76