Hello there, I am using CMP 1.9.0 I am trying to d...
# multiplatform
m
Hello there, I am using CMP 1.9.0 I am trying to display a simple screen. I am deploying on an iPhone 12 and would like to know if anyone else has a (big) margin top and bottom as shown in the screen (above and below the brown background color)? I find it pretty big... Here's my common UI code. I tried removing statusBarsPadding and navigationBarsPadding but it doesn't change anything. Is it a normal behaviour?
Copy code
@Composable
fun App() {
    CustomAppTheme {
        Box(
            Modifier
                .fillMaxSize()
                .background(MaterialTheme.colorScheme.background)
        ) {
            Box(
                Modifier
                    .fillMaxSize()
                    .statusBarsPadding()
                    .navigationBarsPadding()
                    .border(2.dp, Color.Magenta)
            ) {
                Text("This a text to test screen size on iPhone", color = Color.White)
            }
        }
    }
c
Did you modified the SwiftUI code in the default template by any chance? It seems the black paddings are made on the Swift side. Composables should be inserted to a UIKit view to be rendered using APIs like
ComposeUIViewController
, and the default template uses SwiftUI's
UIViewControllerRepresentable
to host a Compose view. I also suggest you to go to #C0346LWVBJ4.
m
I fixed it like a minute ago. I let Xcode generate the Info.plist and somehow it fixed it
c
Glad to hear that! I can't relate Info.plist to the behavior of the padding with my knowledge right now, but it would be great if you find out and share which configuration affected that behavior 😃
m
Well, I don't have much to say honestly since I am a former Android developer, exploring KMP for a year now 😂
😢 1