-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
System WindowInsets Not Consumed on iOS Targets When using Nested Navigators #484
Comments
Can confirm, this is a a huge issue for me and my team. |
I did some more research and checked out #366 and #355 . It seems like this is some kind of compatibility issue between the latest Compose MP plugin and the Compose MP plugin referenced by Voyager. It also seems to be somewhat recurrent across versions ever since Voyager upgraded to Compose MP |
I've tried forking voyager and updating its compose plugin to version 1.7.0-beta02 but unfortunately that doesn't seem to solve the issue. |
I did some research and think the issue might be related to the new implementation of iOS platformLayers: |
I saw that change too. If I recall correctly, there were changes to the way platform layers were used in Compose MP on iOS over the past few versions.
It would be quite coincidental if the changes to the use of Platform Layers in Compose MP on iOS somehow led to this issue with Voyager's Nested Navigators. Note that this issue has been happening in various combinations of Voyager and Compose MP. That said, I still can't find how this affects Voyager Nested Navigators, I was hoping to discover the link and attempt resolving it myself. |
Although not ideal, I've come up with a workaround for this issue: If you want navigation bars or status bars instead of system bars you can change the code accordingly. |
Compose 1.7.0 just got released and the issue still persists. If I could understand how WindowInsets get passed between different navigators I could open a PR but looking at the code I can't find any relevant info. |
Update: WindowInsets get passed until this line in Navigator. CompositionLocalProvider(
LocalNavigatorStateHolder providesDefault rememberSaveableStateHolder(),
LocalWindowInfo provides LocalWindowInfo.current
) {
// Rest of the code
} However, I haven't yet tested if this results in any unwanted side effects. Perhaps there is a better solution, as this one involves a dependency on |
I've opened a PR that fixes this issue and does not involve a dependency on |
Amazing @hristogochev ! 🎉 |
Yes, its essentially the same code but written differently. For some reason calling This is probably a bug on the Compose Multiplatform side, not in Voyager, but this should help until its resolved. |
I've reported the issue to Jetbrains here, in this case the issue affects iOS nested navigator paddings because in 1.7.0-beta02 their iOS implementation depends on a wrapper |
I've been watching the issue you reported here @hristogochev |
In the meantime you can clone my fork of voyager which only contains the pull request for this issue and a configuration for local deployment. Simply clone it, switch to the And voila! You are able to use the newest version of Compose Multiplatform with the newest version of Voyager! |
This is a bit complex to explain, but to summarise, the
WindowInsets
aren't consumed when it is called from a Nested Navigator (navigator.level > 0) on an iOS device withignoreSafeArea
set to.all
inContentView.swift
.This error specifically happens from Voyager
1.1.0-alpha03
(including newer versions) alongside the Compose Multiplatform Plugin1.7.0-beta02
version. Perhaps it is some compose multiplatform plugin compatibility problem.Basically:
Compose MP
1.7.0-beta02
upwards + Voyager1.1.0-alpha03
upwards = Issue occurs ❌Compose MP
1.7.0-beta01
downwards + Voyager (any version) = Working as expected ✅Compose MP (any version) + Voyager
1.1.0-alpha02
downwards = Working as expected ✅To highlight the defect, you can check out this sample reproduction on Github.
Here's the code to explain the problem:
Correct Result
Wrong Result
NOTES:
systemBarsPadding()
is called in the First Navigator, the insets padding is applied normally.ContentView.swift
has its code like.ignoresSafeArea(.all)
in order to draw from edge to edge.The text was updated successfully, but these errors were encountered: