Status Update
Comments
jn...@google.com <jn...@google.com> #2
Thanks for the very thorough bug report and repro sample - really appreciate it.
I have reproduced on a Samsung SM-R870 but emulator and a collection of other devices I have tried are all just fine.
Also other SLCs examples I have tried work fine on SM-R870 - some there is something interesting/weird that needs further investigation - I will take a look
jn...@google.com <jn...@google.com> #3
So the padding on the Button
inside your TextButton
is what seems to be triggering the bug - super weird.
Also for the record what I believe is happening is that the list items are drawn transparently. The SLC does a 2 phase initialisation in order for the user not to see the initial scrolling into position of the center item. In the first phase the items are drawn transparently and then we scrollToItem
in a LaunchedEffect
and redraw the items normally.
jn...@google.com <jn...@google.com>
jn...@google.com <jn...@google.com>
ap...@google.com <ap...@google.com> #4
Branch: androidx-main
commit 005ca24b33a173e41f7657f9f1a42edf2dea4433
Author: John Nichol <jnichol@google.com>
Date: Wed Jun 01 17:58:35 2022
Fix ScalingLazyColumn initialization bug if the 0th list items was large
If the 0th list item in a ScalingLazyColumn is large enough it is possible that the list will not draw correctly until after the list has been scrolled. This is caused by the ScalingLazyColumn initially drawing items transparently in order to then do a correct scroll to the required initial item index without the user seeing the scroll. The calculation to determine whether to draw the items transparently or not was failing to correctly take into account the gap between list items and so could incorrectly determine that the list was still uninitialized.
Bug: 234328517
Test: ./gradlew :wear:compose:compose-material:connectedCheck --info --daemon
RelNote: "We have fixed a bug in the ScalingLazyColumn that could result in the list items not drawing correctly until scrolled if the 0th list item was large enough (including padding)"
Change-Id: Ic6159b18937d97f9bb580cf59810880288ad6d4e
M wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/ScalingLazyListState.kt
M wear/compose/compose-material/src/androidAndroidTest/kotlin/androidx/wear/compose/material/ScalingLazyColumnTest.kt
jn...@google.com <jn...@google.com> #5
So we have managed to isolate and reproduce the problem on the emulator and add some targeted tests.
[Deleted User] <[Deleted User]> #6
[Deleted User] <[Deleted User]> #7
I would work-around the problem for now, so please let me know if the bug fix is released. Thanks again!
jn...@google.com <jn...@google.com> #8
Release in Compose for Wear OS rc01
Description
Version used: 1.0.0-beta02
Devices/Android versions reproduced on:
- Can be 100% reproduced on Samsung SM-R870, SM-R865F (both are Android 11, Wear 3.2, One UI 4.0)
- Failed to reproduce on Wear OS Simulator (API 30, Wear 3.2)
Description:
I found sometimes ScalingLazyColumn wouldn't display items at first until I scrolled the view. (My displayed items are not dynamically changed by recompose. The only thing I do is scrolling.)
And I also found that (1) if I add another item to ScalingLazyColumn and rebuild the app, or (2) if I add some vertical padding to one of the item,
items could be display successfully.
So I guess it might be related to the item height or item count... I'm not sure.
- Code:
(With the code above, the issue could be 100% reproduce on Samsung SM-R870, SM-R865F)