Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show TimeLane even if the visibleItemsInfo is empty #904

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
show TimeLane even if the visibleItemsInfo is empty
  • Loading branch information
mochico committed Oct 11, 2022
commit 3ecace122120af70e7461f9b5234b52a71dde791
Original file line number Diff line number Diff line change
@@ -23,6 +23,23 @@ fun TimeLane(
}
}
var currentDurationTime: DurationTime? = null

if (visibleItemsInfo.value.isEmpty()) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reviewer:
The original cause of missing TimeLane in the preview was: the preview is a preview, and the scroll does not happen, so visibleItemsInfo is empty.
This should fix the original problem of missing TimeLane in the Preview screenshot tests and should not break the product but it is open to the argument if we have to put the code for the test. If you think it better to avoid placing the code for testing, you'd better update the expected screenshot in the test.

// For preview
val durationTime = timetable[0].first
Box(
modifier = modifier.offset {
IntOffset(
x = 0,
y = 0,
)
}
) {
content(durationTime)
}
return
}

visibleItemsInfo.value.forEachIndexed { visibleItemIndex, visibleItemInfo ->
val durationTime = timetable[visibleItemInfo.index].first
if (currentDurationTime != durationTime) {