After a frustrating search today, I learned that o...
# compose-ios
m
After a frustrating search today, I learned that on the iPad, when in landscape mode, there's no safe area allocated for the status bar. This is unlike Android's behaviour which allocates a Window inset for the status bar in both portrait and landscape. So in Compose Multiplatform, when I call
statusBarsPadding()
, no padding is applied when the app is in landscape on the iPad. Has anyone else encountered this? Please what did you try as a workaround? PS: I'm already using
ComposeView().ignoresSafeArea(.all)
in the SwiftUI part. https://developer.apple.com/design/human-interface-guidelines/layout#iOS-iPadOS-safe-areas
👀 2
a
Oh, well. that's sad. I will take a look on it.
🙏 2
m
Thank you. I dug deeper into the code to see why this was happening and saw this:
Copy code
actual val WindowInsets.Companion.statusBars: WindowInsets
    @Composable
    @OptIn(InternalComposeApi::class)
    get() = when (LocalInterfaceOrientation.current) {
        InterfaceOrientation.Portrait -> iosSafeArea.only(WindowInsetsSides.Top)
        else -> ZeroInsets
    }
I guess it was intentional? 🤷‍♂️ In the meantime, I'll be using this when I want to explicitly use
statusBarsPadding()
on Expanded iOS screens
Copy code
.windowInsetsPadding(WindowInsets.systemBars.only(WindowInsetsSides.Top))
PS: The issue also happens when my iPad is portrait upside down as well. Which makes sense when you look at the source code.
a
Thank you for clarification. If on iPad does not contain top safe area, it's expected that status bar padding will be 0. We need to check possible solutions, but it will take some time.
thank you color 1
m
Thanks for fixing this!