Closed devraj closed 2 years ago
Hmmmm, do you navigate from a page that presents the notification to another one that has the same behavior? It seems like the screen dismisses the notification when it disappears, and that the next presented view also presents it?
Would it be possible to move the present logic to the navigation view file instead? You don't need to explicitly dismiss it, since it will dismiss itself after a few seconds.
Also, the context should be defined as a @StateObject
in the navigation view file, but passed down as an @EnvironmentObject
.
My bad! I had it as @StateObject
in the children. That fixed it, thank you so much.
Out of interest does SheetContext
in SwiftUIKit
have the same pattern?
Ah, thatโs great! ๐
Yeah, the sheet, alert and full screen modal contexts in SwiftUIKit behaves similar.
The app looks ๐ฏ btw ๐
Look out for the links in the credits section ๐
Haha nice!
Environment:
It's most likely that I am doing something wrong here, but I am at a dead end, hence posing the question here. If it turns out to be something I am doing then it will be something good to make a note of and make it available as part of the documentation.
My view somewhat looks like this
and is displayed in a
NavigationView
, the function that callsSystemNotification
looks likeThe
notificationContext
is bound to theNavigationView
and it's reference passed down to the children as a
@StateObject
. Note that I do useSwiftUIKit
and the modifier follows the.systemNotification
modifier (which i wouldn't think would be causing the issue).Video demo, I can make available the source and the app via TestFlight if it's of any use: