Change HomeScreen.kt topbar behaviour#1903
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b34884622c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| val isScrolledPastThreshold = remember { | ||
| derivedStateOf { listState.firstVisibleItemIndex > 0 || listState.firstVisibleItemScrollOffset > 180 } | ||
| derivedStateOf { listState.firstVisibleItemIndex > 0 || listState.firstVisibleItemScrollOffset > scrollThresholdPx } |
There was a problem hiding this comment.
Recreate derived scroll state when density changes
isScrolledPastThreshold is created with remember { ... } but reads scrollThresholdPx, so when LocalDensity changes at runtime (for example after display-size/font-scale changes in a live composition), the derived state keeps using the old captured threshold and the top bar transition triggers at the wrong offset until recreation. Key the remember with scrollThresholdPx (or compute threshold inside the derived block) so the threshold actually updates with density.
Useful? React with 👍 / 👎.
|
Spotted by Gemini: Caution Compilation Error: Duplicate Parameter |
|
Hi! This is weird, seems like a git error, my build worked fine with this changes |
No description provided.