Can we get the scroll amount of Compose TextField?
# compose
m
Can we get the scroll amount of Compose TextField?
s
The newest APIs expose a ScrollState as a parameter https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]=BasicTextField&ss=androidx%2Fplatform%2Fframeworks%2Fsupport so you can pass in your own remembered ScrollState and derive from it what the scroll situation is like. This may not be present in the latest stable releases though, I think this only started being a thing when BasicTextField2 was renamed to just BasicTextField
thank you color 3
m
Thanks! I'm currently having this issue when I draw a custom shape in the rich text editor. Because
MultiParagraph
get line bounds methods are not taking the scroll into consideration, otherwise it works fine for
BasicText
.
s
Are you using these new BTField APIs? If there’s something which you think should work but doesn’t just file an issue is what I’d suggest. Can’t say I’ve done something similar myself to have a better idea here.
thank you color 1
h
there's no way to get this information with the current stable TextField API. The new BasicTextField exposes this information but it's not ready to be a basis for a rich text editor since it cannot render AnnotatedStrings.
thank you color 1
However, I should note that it's certainly in our immediate future plans to support multi style text rendering/editing
🌟 2
m
Thanks! Looking forward to those updates.
m
I recognised your name from the Compose Rich Editor library @mohamed rejeb Thank you for that, looking forward to implementing it in my project soon.
🙌 1
v
Following for updates. The thing I'm doing in my own rich text editor is super hacky and I'm eager for better support.
s
Have you tried the new BTF APIs Victoria? Does that not fill your requirements here?
v
Unfortunately, I haven't had the time to revisit our rich text component to see.
👍 1
m
v
I think I looked at that for initial inspiration! It doesn't meet every requirement we have, but it was super helpful in learning how to handle certain things ❤️