https://kotlinlang.org logo
#compose
Title
# compose
a

Andrew Watson

12/06/2023, 10:52 PM
Hey, I'm seeing a bug when clicking on TextFields in Android. After the first tap, if i dismiss the keyboard and then tap again, the keyboard doesn't come back up. The kicker is that this is a compose multiplatform bug that I'm only seeing on Android. The compose multiplatform GH issue tracker says I should file with Google but I'm not so sure I should do that:
d

dorche

12/06/2023, 11:12 PM
Report it to Google, Compose Multiplatform should be the same as Compose Android in that case Ideally create a min repro with Compose Android.
n

navczydev

12/06/2023, 11:46 PM
@Andrew Watson which version are you using ?
a

Andrew Watson

12/06/2023, 11:47 PM
Compose 1.5.4, Compose plugin 1.5.11
n

navczydev

12/06/2023, 11:50 PM
After dismissing the keyboard, Did you tap again into the field or just moving the cursor back&forth
a

Andrew Watson

12/06/2023, 11:50 PM
A little hard to tell from the video, but I was tapping on it
👍 1
n

navczydev

12/06/2023, 11:58 PM
Tested on the Compose on Android and its reproducible so its not just multiplatform
a

Andrew Watson

12/06/2023, 11:58 PM
WAT wow, okay
Can you share a video of what you're seeing? I'm actually quite surprised
n

navczydev

12/07/2023, 12:00 AM
I am using material
so let me try the foundation
a

Andrew Watson

12/07/2023, 12:00 AM
Not material 3?
n

navczydev

12/07/2023, 12:00 AM
Yes Material3
a

Andrew Watson

12/07/2023, 12:00 AM
Oh interesting, cuz I'm using older material too
I guess, maybe it's not considered a bug then? Maybe app developers just manually have to open the keyboard in such cases?
🫥 1
n

navczydev

12/07/2023, 12:02 AM
Copy code
1.2.0-alpha12
Material 3 this version I am using
Compose-TextField.mp4
a

Andrew Watson

12/07/2023, 12:07 AM
Interesting
n

navczydev

12/07/2023, 12:08 AM
even its reproducible in foundation too
a

Andrew Watson

12/07/2023, 12:08 AM
Well then. I guess I might just have to with what I've got
d

dorche

12/07/2023, 12:15 AM
Can one of you share a minimal code example that reproduces this?
n

navczydev

12/07/2023, 12:16 AM
Copy code
@Composable
fun SelectableRowDemo(itemLabel: String) {
    var string by remember {
        mutableStateOf("Hello")
    }
    Row(
        modifier = Modifier
            .fillMaxWidth()
            .padding(Dimens.paddingMedium),
    ) {
      //  androidx.compose.material3.TextField(value = string , onValueChange = {string = it} )
        BasicTextField(value = string, onValueChange = {string = it})
    }
}
a

Andrew Watson

12/07/2023, 12:17 AM
Yeah here's mine:
Copy code
import androidx.compose.material.TextField
@Composable
fun AnyComposable() {
    MaterialTheme {
        Column(
            modifier = Modifier
                .fillMaxSize(),
            horizontalAlignment = Alignment.CenterHorizontally
        ) {
            val inputVal = remember { mutableStateOf("") }
            TextField(
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(
                        all = 16.dp
                    ),
                value = inputVal.value,
                onValueChange = {
                    inputVal.value = it
                }
            )
        }
    }
}
n

navczydev

12/07/2023, 1:07 PM
Fix for this is coming in next beta release https://issuetracker.google.com/issues/311437241
☝🏻 1
a

Andrew Watson

12/07/2023, 11:22 PM
Amazing! Thanks for the fast response.