PopupView icon indicating copy to clipboard operation
PopupView copied to clipboard

[BUG] Popup does not appear

Open francescoleoni98 opened this issue 11 months ago • 7 comments

Expected Behavior

A popup

Current Behavior

The popup is not visibile. But the view dims.

Code Sample

public struct FeedbackView: CenterPopup {

	public var body: some View {
		Text("Test")
			.padding()
			.background(.red)
	}
}

@main
struct LinkboardApp: App {

        var body: some View {
			NavigationView {
				Button("Tap") {
						Task {
							await FeedbackView().present()
						}
					}
			}
			.registerPopups()
        }
}

Screenshots

Image

SDK 4.0.1 Xcode 16.0 (16A242d) iOS 18.2 iPhone 12

francescoleoni98 avatar Jan 29 '25 11:01 francescoleoni98

same error

BestKai avatar Feb 21 '25 07:02 BestKai

@BestKai @FulcrumOne @francescoleoni98 have you guys find a workaround or fixed?

JadeGeek avatar Feb 26 '25 22:02 JadeGeek

@BestKai @FulcrumOne @francescoleoni98 have you guys find a workaround or fixed?

I just built a small popup that serves my minimal needs

francescoleoni98 avatar Feb 26 '25 22:02 francescoleoni98

@BestKai @FulcrumOne @francescoleoni98 have you guys find a workaround or fixed?

The suggested "fix" was to go to an earlier version that worked. 4.0.0 threw an exception, 3.x requires redoing (again) the interface. I am tired of the breaking changes so I gave up. I am using a different library.

DavidViggiano avatar Feb 26 '25 23:02 DavidViggiano

https://github.com/Mijick/Popups/wiki/Setup Option2 may fix it

mny459 avatar Feb 27 '25 10:02 mny459

https://github.com/Mijick/Popups/wiki/Setup Option2 worked for me. Option 1 is not working with NavigationView and NativationStack thanks @mny459

mtcn avatar Mar 18 '25 00:03 mtcn

Reproduced on macOS: 15.4.1 (24E263) xCode: 16.2 (16C5032a)

  • Reproduced on build for macOS
  • Used option 1 from Setup
  • Option 2 works only for iOS
  • There are no NavigationStack used in my project

used code:

import MijickPopups

struct Popups {
    static func showHelloWorld() {
        Task {
            await TopCustomPopup()
//                .dismissAfter(6)
                //.setEnvironmentObject(myObject)
                .present(popupStackID: .shared)
        }
    }
}


struct TopCustomPopup: TopPopup {
    var body: some View {
        HStack(spacing: 0) {
            Text("Hello World")
            Spacer()
            Button(action: { Task { await dismissLastPopup() }}) { Text("Dismiss") }
        }
        .padding(.vertical, 20)
        .padding(.leading, 24)
        .padding(.trailing, 16)
    }
    
    func configurePopup(config: BottomPopupConfig) -> BottomPopupConfig {
        config
            .popupHorizontalPadding(20)
            .popupTopPadding(42)
            .cornerRadius(16)
    }
    
    func onDismiss() {
        print("Popup dismissed")
    }
    
    func onFocus() {
        print("Popup is now active")
    }
}

applied on MainView:

        .registerPopups(id: .shared) { config in config
           .vertical { $0
               .enableDragGesture(true)
               .tapOutsideToDismissPopup(true)
               .cornerRadius(32)
           }
           .center { $0
               .tapOutsideToDismissPopup(false)
               .backgroundColor(.white)
           }
       }

on subview:

var popupBool = false
        .onTapGesture {
            if popupBool {
                Task { await dismissLastPopup() }
            } else {
                Popups.showHelloWorld()
            }
            
            popupBool.toggle()
        }

any ideas?

ukushu avatar Apr 19 '25 22:04 ukushu