I am using Compose for many years, it's more conve...
# compose
k
I am using Compose for many years, it's more convenient than View but I complain it everyday. It's still not mature anyway, there are lots of bugs in the libraries, I have to write my own version, from color system to navigation to m3 components... I really don't understand why the code in library is so complex and there are so many severe bugs which prohibit daily use. My rewrite version will only need less code and performs well (fewer bugs and better performance), for example the
LazyHorizontalPager
is only 200 lines (including
PagerState
). There is a bug in the official `HorizontalPager`: when you scroll to fling, then touch screen, it will transform touch event into small scroll event... so the users can't click and have to wait for the animation finished. In terms of performance, to optmize it will take complex measures, such as using custom
Layout
,
Modifier.Node
to cahce something, and make the recomposition less. If you animate the
TextStyle
in
Text
, it will recompose on every frame and very laggy, I have to create a custom
Modifier.Node
to make it not to recompose. So the work amount is indeed increasing. I am tired of writing compose now, it makes me headache.
πŸ‘ 1
πŸ’†β€β™‚οΈ 4
s
Have you tried reporting bugs for things you find like that problem with the pager fling behavior? What issues do you have with the navigation integration in particular? Writing your own color system other than m3, you absolutely need to do that if your app is not following the material design system obviously. For the animated text scenario, have you tried using TextMotion.Animated https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]n/kotlin/androidx/compose/ui/text/style/TextMotion.kt;l=35-41 which should help with performance?
s
Hey there! I'm genuinely intrigued to see your 200-line LazyHorizontalPager and any benchmarks you might have. It sounds like quite the marvel! Sharing it could be hugely beneficial for everyone here, helping to understand your approach and potentially inspiring improvements. 😊
πŸ’― 3
e
To play devil's advocate, I've been using Compose for 2+ years, and I rarely complain or experience bugs (especially the kind that prohibit any use). I'm very grateful for the amazing material components, and if I ever need to tweak them or make my own version (because a more targeted implementation made for a specific use case could potentially be more optimized) it's much easier and straightforward than it was with View. I enjoy reading the source, as it's relatively easy to understand and copy, especially compared to View. I love writing Compose, and it's gotten rid of a lot of my headaches 😈
πŸ‘πŸΎ 2
βž• 5
πŸ‘πŸ» 1
slow parrot 3
πŸ‘ 16
K 9
b
Agree 100% here as well
k
@Sergey Y. Hi, I may publish the entire library in the future. But it has some project use cases which may be unsuitable to publish. They are highly optmized that minimized the recomposition count, the lazy pager is 0 recomposition even if you change the page or integrate with an animated tab bar.
K 1
@Stylianos Gakis Isn't
TextMotion.Animated
only enable subpixels, but don't prevent recompose?
s
Yeah, I didn't say it'd stop recompositions, but it's there to make animating text look smoother.
k
Yes, I have already use it.
πŸ‘ 1