Skip to content

System WindowInsets Not Consumed on iOS Targets When using Nested Navigators #484

@mofeejegi

Description

@mofeejegi

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 with ignoreSafeArea set to .all in ContentView.swift.

This error specifically happens from Voyager 1.1.0-alpha03 (including newer versions) alongside the Compose Multiplatform Plugin 1.7.0-beta02 version. Perhaps it is some compose multiplatform plugin compatibility problem.
Basically:
Compose MP 1.7.0-beta02 upwards + Voyager 1.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:

@Composable
@Preview
fun App() {
    MaterialTheme {
        Surface {
            Navigator(screen = FirstScreen())
        }
    }
}

class FirstScreen : Screen {
    @Composable
    override fun Content() {
        Box(modifier = Modifier.fillMaxSize().background(color = Color.Blue)) {
            Navigator(screen = SecondScreen())
        }
    }
}

class SecondScreen : Screen {
    @Composable
    override fun Content() {
        Box(modifier = Modifier.fillMaxSize().systemBarsPadding().background(color = Color.Green)) {}
    }
}

Correct Result

Wrong Result

NOTES:

  • If the insets systemBarsPadding() is called in the First Navigator, the insets padding is applied normally.
  • iOSApp ContentView.swift has its code like .ignoresSafeArea(.all) in order to draw from edge to edge.
  • I'm not sure if this a Voyager issue or Compose Multiplatform issue (or perhaps both).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions