Open Khang-NT opened 11 months ago
Describe the bug UIKitView displays behind another view within a Column, let's look at the screenshot, the text view on iPhone is behind the text box.
Column
Affected platforms Select one of the platforms below:
Versions
To Reproduce
// common @Composable fun Reproduce() { Column(Modifier.fillMaxWidth().padding(8.dp)) { Row { OutlinedTextField( value = "", onValueChange = { }, modifier = Modifier.weight(1f), ) Button( onClick = { }, modifier = Modifier.align(Alignment.CenterVertically), ) { Text("Test") } } TestPlatformView(Modifier.weight(1f)) } } expect fun TestPlatformView(modifier: Modifier) // Android @Composable actual fun TestPlatformView(modifier: Modifier) { AndroidView( factory = { context -> TextView(context).apply { this.text = Array(100) { "$it" }.joinToString("\n") } }, ) } // iOS @Composable actual fun TestPlatformView(modifier: Modifier) { UIKitView( factory = { UITextView().apply { this.text = Array(100) { "$it" }.joinToString("\n") } }, modifier = modifier, ) }
Expected behavior UITextView shouldn't be overlapped.
UITextView
Additional context If wrap UIKitView with Box, the issue will be gone:
UIKitView
Box
Box(modifier) { UIKitView(modifier = Modifier.fillMaxSize(), ...) }
If you replace TestPlatformView(Modifier.weight(1f)) with TestPlatformView(Modifier.fillMaxSize()) it's also working well.
UIKitView widget doesn't properly communicate its layout when used alone.
Describe the bug UIKitView displays behind another view within a
Column
, let's look at the screenshot, the text view on iPhone is behind the text box.Affected platforms Select one of the platforms below:
Versions
To Reproduce
Expected behavior
UITextView
shouldn't be overlapped.Additional context If wrap
UIKitView
withBox
, the issue will be gone: