fix(chat): allow swipe-to-dismiss on the conversation sheet - #1187
Merged
Conversation
The chat message list is a reverseLayout=true LazyColumn but had sheetResignmentBehavior applied — a guard built for top-anchored lists and the only reversed-list usage in the app. That guard treats firstVisibleItemIndex==0 && offset==0 as the sheet's downward dismiss boundary. In a reversed list that position is the resting state (newest message), not a scroll edge, so the guard forced the sheet's allowDismiss flag to false at rest. Swiping down let the reversed list consume the drag as a history scroll, flipping the guard into onScrolledAway() which permanently disabled dismiss and cancelled the re-enable timer. allowDismiss gates confirmDetentChange for the whole sheet, so it snapped back instead of dismissing — even for header/handle drags. Remove the modifier from the chat list: a downward drag on messages already scrolls history via nested scroll, and dismiss comes from the header/handle drag, scrim tap, and back.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Swiping down on a chat sheet starts to move it but snaps back before reaching the dismiss threshold — the sheet can't be dismissed by drag.
Root cause
The chat message list (
MessageList.kt) is areverseLayout = trueLazyColumn(newest at the bottom, index0= bottom), but it had.sheetResignmentBehavior(listState)applied. That modifier is built for top-anchored lists — and this was the only reversed-list usage among the 9 in the app.The guard decides "am I at the sheet's downward dismiss boundary?" via
firstVisibleItemIndex == 0 && firstVisibleItemScrollOffset == 0. For a normal list that's the top scroll edge. For the reversed chat list, index0/offset0 is the resting position (newest message), not a scroll edge:allowDismissflag tofalse(it gatesconfirmDetentChangefor the whole sheet).firstVisibleItemScrollOffsetchanges → the modifier flips intoonScrolledAway(), which disables gestures with no auto-reset and cancels the 700 ms re-enable timer.allowDismissstaysfalse, so the sheet can't settle toHiddenand snaps back — even for header/handle drags.Fix
Remove
.sheetResignmentBehavior(listState)(and its now-unused import) from the chat list. Its model — "only allow dismiss at the list's scroll edge" — doesn't fit a chat: a downward drag on messages already scrolls history via nested scroll, and dismiss is meant to come from the header/handle drag, scrim tap, and back.Testing
:apps:flipcash:features:messenger:compileDebugKotlinpasses.