[BUG] Popup does not appear
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
SDK 4.0.1 Xcode 16.0 (16A242d) iOS 18.2 iPhone 12
same error
@BestKai @FulcrumOne @francescoleoni98 have you guys find a workaround or fixed?
@BestKai @FulcrumOne @francescoleoni98 have you guys find a workaround or fixed?
I just built a small popup that serves my minimal needs
@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.
https://github.com/Mijick/Popups/wiki/Setup Option2 may fix it
https://github.com/Mijick/Popups/wiki/Setup Option2 worked for me. Option 1 is not working with NavigationView and NativationStack thanks @mny459
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
NavigationStackused 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?