Skip to content

[BUG] Popup does not appear #174

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

Open
francescoleoni98 opened this issue Jan 29, 2025 · 7 comments
Open

[BUG] Popup does not appear #174

francescoleoni98 opened this issue Jan 29, 2025 · 7 comments
Assignees
Labels

Comments

@francescoleoni98
Copy link

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

@BestKai
Copy link

BestKai commented Feb 21, 2025

same error

@JadeGeek
Copy link

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

@francescoleoni98
Copy link
Author

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

I just built a small popup that serves my minimal needs

@DavidViggiano
Copy link

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

@mny459
Copy link

mny459 commented Feb 27, 2025

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

@mtcn
Copy link

mtcn commented Mar 18, 2025

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

@ukushu
Copy link

ukushu commented Apr 19, 2025

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?

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

No branches or pull requests

8 participants