Comments (6)
Unfortunately I hit issues when trying to work around this issue. For example, I tried variations on this theme to avoid chaining cover
and sheet
on the same view:
.cover(
isPresented: coverBinding,
onDismiss: nil,
content: { next }
)
.background(
Text("").hidden()
.sheet(
isPresented: sheetBinding,
onDismiss: nil,
content: { next }
)
)
That works around the issue on iOS 14.4 and below, but introduces a bug (even on iOS 15), where presenting a screen five layers of presentation deep fails with this error:
Attempt to present <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x7f9f3ef6c7d0> on <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x7f9f3f91af40> (from <_TtGC7SwiftUI19UIHostingControllerGVS_15ModifiedContentVVS_22_VariadicView_Children7ElementVS_24NavigationColumnModifier__: 0x7f9f3ef489d0>) which is already presenting <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x7f9f3ef5a6f0>
Instead, conditionally applying only one of the modifiers (#13) seems to work around the issue without introducing any regressions. Sadly, on iOS 14.4 and below, the Attempt to present
error still occurs when the number of presentation layers reaches five, but I think that may be a limitation/bug of SwiftUI.
I'll continue to check the solution works well before merging...
from flowstacks.
Thanks for solving it!
from flowstacks.
Thanks for raising this issue, I'm glad you like the library. I understand there was a bug in SwiftUI in iOS 14 that is fixed in iOS 14.5 upwards:
Resolved Issues
- You can now apply multiple sheet(isPresented:onDismiss:content:) and fullScreenCover(item:onDismiss:content:) modifiers in the same view hierarchy. (74246633)
I think it makes sense for this library to work around the issue; I'll have a look. Thanks!
from flowstacks.
Thank you for the investigation @johnpatrickmorgan 🙏🏻
from flowstacks.
The workaround #12 is now merged in v0.1.4, so both presentation styles should now work as expected on iOS versions below 14.5. I added availability checks to only employ the workaround when the iOS version was less than iOS 14.5. Thanks for raising this issue @tscdl!
from flowstacks.
Thanks for the quick reply!
Interesting. I just downloaded the 14.5 simulator runtime. In fact the problem disappears.
from flowstacks.
Related Issues (20)
- Not updating the view after e.g. coverScreen or push HOT 3
- NavigationView state gets reset when presenting and dismissing view on NavigationView HOT 1
- Xcode 14 beta 5, iOS 16, various warnings about publishing updates within view updates HOT 3
- goBackToRoot with dismiss all opened sheets HOT 2
- [iOS 14] View pops back if Router is inside of other HOT 6
- Dismiss when nothing is presented remove the root node HOT 1
- Support custom transition HOT 2
- Toolbar button presenting sheet only works once on iOS... HOT 5
- Not able to achieve Translucent background for fullScreenCover or sheet HOT 1
- Huge Memory Spike When Taking Screenshot
- 17 os navigation problems HOT 1
- ios 17.0.3 backToRoot() and goBackTo(index: 0) problems HOT 1
- Xcode warning in 0.3.5 version HOT 3
- Screen is dismissed twice when swiping down on a sheet HOT 9
- Call on navigator on nested view crashes the app HOT 1
- `@Environment(\.dismiss)` no longer works when using 0.3.5 HOT 4
- Who is responsible for removing the node from the Routes when the sheet is dismiss from a swipe ? HOT 2
- EnvironmentObject FlowNavigator causes memory leak HOT 1
- When using the popToRoot function, it appears that views are being dismissed one by one instead of directly navigating to the root view HOT 2
- Inconsistent state of Routes variable after present/push when VC is presented on top (from UIKit) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flowstacks.