onebone/compose-collapsing-toolbar

IME goes over the focused TextField

Opened this issue · 0 comments

I've played around with the sample app and there's an issue if you enable edge to edge with the keyboard. It scrolls the Column but not enough to keep it in view. Sample code:

class MainActivity: ComponentActivity() {
	override fun onCreate(savedInstanceState: Bundle?) {
		super.onCreate(savedInstanceState)
		WindowCompat.setDecorFitsSystemWindows(window, false)
		setContent {
			CollapsingToolbarTheme { MainScreen() }
		}
	}
}

@Composable
fun MainScreen() {
	CollapsingToolbarScaffold(
		modifier = Modifier
			.statusBarsPadding()
			.imePadding()
			.fillMaxSize(),
		state = rememberCollapsingToolbarScaffoldState(),
		scrollStrategy = ScrollStrategy.EnterAlwaysCollapsed,
		toolbar = {
			TopAppBar(
				title = { Text(text = "Title") },
				modifier = Modifier.height(56.dp),
			)
		}
	) {
		Column(
			modifier = Modifier
				.fillMaxWidth()
				.verticalScroll(rememberScrollState())
				.navigationBarsPadding(),
		) {
			repeat(100) {
				TextField(
					value = "Item $it",
					onValueChange = {},
					modifier = Modifier.padding(8.dp)
				)
			}
		}
	}
}

I'm sure it has to do with the body offset when toolbar is expanded. LazyColumn is worse, losing the focus when keyboard is showing (that's for sure a compose issue). Any thoughts on this?