https://kotlinlang.org logo
Title
l

Long Tran

03/27/2022, 7:21 AM
Hi guys, I'm trying to customize TextField to center its content. Everything else is okay except the cursor, i don’t know if there is a way to center it. Thanks for your help!!! 🙇
r

ritesh

03/27/2022, 8:54 AM
Probably you need a textStyle
textStyle = LocalTextStyle.current.copy(textAlign = TextAlign.Center)
l

Long Tran

03/27/2022, 9:48 AM
Did it, but it looks like a bug. When I type in, both the text and the cursor will be centered, but if I leave it empty like in the photo, the cursor will be back to the start 🤷‍♂️
c

Chris Sinco [G]

03/27/2022, 9:58 AM
cc @Anastasia [G]
l

Long Tran

03/28/2022, 1:01 AM
Hi, does anyone has an update on this?
c

Chris Sinco [G]

03/28/2022, 4:17 AM
This was posted on the weekend so I’d expect more responses to this later in the week 🙂
a

Anastasia [G]

04/06/2022, 1:30 PM
The proposed solution should work. If it doesn't, feel free to file a bug to the Text component with the repro sample.
l

Long Tran

04/12/2022, 3:25 AM
Yes, it works. But on Android only, bug is happened on Desktop.