I have a HorizontalPager in my screen with 2 pages. Both contain one EditText. When I navigate from first page to second, the EditText in second page doesn't display any text (not even the hint) for sometime. Only when I type some characters and stop, the text appears and after that it works properly.
My code:
val pagerState = rememberPagerState(initialPage = 0)
HorizontalPager(count = 2, state = pagerState) {
AndroidView(
modifier = Modifier.width(200.dp),
factory = { context ->
AppCompatEditText(context).apply {
hint = "Page $it"
}
}
)
}
Maybe there is some problem in the way Horizontal Pager initially loads Composables for subsequent pages.
How can I fix this?
(I am not using TextField as it has some other nasty bugs)