You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the share dialog is presented, the view underneath is dismissed.
Expected behaviour
System share dialog partially covers the view and let users to share the package and the view must stay visible the whole time. Once share is done or canceled, a user is still on the same view where the share was triggered.
Why?
It wasn't easy to find the root cause because there were too many variables that could play a role but in the end it's probably a bug in SwiftUI iOS 15. The following construct in SwiftUI
doesn't work. The TabView nested inside NavigationView works fine for many other scenarios we needed until we hit the issue with system share dialog. SwiftUI for some reason triggers logic to dismiss the view.
Possible Solutions
Easiest one
Fix is a one liner in iOS 16. NavigationView is deprecated iOS 16+ and NavigationStack is the future, everything works fine with NavigationStack but it forces us to upgrade the deployment target.
This fixes the problem but creates many more others. The navigation bar is no longer visible so title of the screen + settings buttons are no longer available. Any view presented in a navigation flow way is nested inside tab, so it requires us to do all such views modal ones. The transition animations would look different as well. It's a big change that basically changes the overall navigational pattern and behaviours that don't match Figma design.
The text was updated successfully, but these errors were encountered:
The bug
When the share dialog is presented, the view underneath is dismissed.
Expected behaviour
System share dialog partially covers the view and let users to share the package and the view must stay visible the whole time. Once share is done or canceled, a user is still on the same view where the share was triggered.
Why?
It wasn't easy to find the root cause because there were too many variables that could play a role but in the end it's probably a bug in SwiftUI iOS 15. The following construct in SwiftUI
doesn't work. The TabView nested inside NavigationView works fine for many other scenarios we needed until we hit the issue with system share dialog. SwiftUI for some reason triggers logic to dismiss the view.
Possible Solutions
Easiest one
Fix is a one liner in iOS 16. NavigationView is deprecated iOS 16+ and NavigationStack is the future, everything works fine with NavigationStack but it forces us to upgrade the deployment target.
Complex one
Staying on iOS 15 requires to swap the order of views, the TabView would be the parent and everything else must be done inside of it:
This fixes the problem but creates many more others. The navigation bar is no longer visible so title of the screen + settings buttons are no longer available. Any view presented in a navigation flow way is nested inside tab, so it requires us to do all such views modal ones. The transition animations would look different as well. It's a big change that basically changes the overall navigational pattern and behaviours that don't match Figma design.
The text was updated successfully, but these errors were encountered: