79346463

Date: 2025-01-10 17:08:08
Score: 0.5
Natty:
Report link

After research and trial and error, I discovered that I simply needed to remove Modifier.focusable() from the Box modifier.

Updated code... SettingsScreen.kt

@Composable
fun SettingsScreen(onBackClick: () -> Unit) {
    val focusRequester = remember { FocusRequester() }
    BackHandler {
        Log.e("TAG", "SettingsScreen: BackHandler Called Close")
        onBackClick()
    }
    Box(
        modifier = Modifier
            .fillMaxSize()
            .background(color = SettingsBG)
            .focusRequester(focusRequester = focusRequester)
    ) {
        Column {
            MPButton(text = "Text 1") {
                Log.e("TAG", "SettingsScreen: text 1 click")
            }
            MPButton(text = "Text 2") {
                Log.e("TAG", "SettingsScreen: text 2 click")
            }
        }
    }

    LaunchedEffect(Unit) {
        focusRequester.requestFocus()
    }
}

Let me know if you need any help with Jetpack Compose. We need to build a large community for Jetpack Compose.

Reasons:
  • Blacklisted phrase (1): any help
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Vishal Bhimporwala