Skip to content

Commit

Permalink
fix: wrong pointerInput invoked on scroll inside message list
Browse files Browse the repository at this point in the history
  • Loading branch information
trOnk12 committed Jul 28, 2023
1 parent 0b358cb commit e4aeb14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ fun ClickableText(
val currentOnLongClick by rememberUpdatedState(newValue = onLongClick)
val currentLayoutResult by rememberUpdatedState(layoutResult)

val pressIndicator = Modifier.pointerInput(Unit) {
// even though the rememberUpdateState, should be working, we still do not get the reference to the correct
// lambda's mainly when we scroll to the top of the list and then back to the bottom, it looks like, the reference
// does not get updated to point to the correct lambda. currentLayoutResult, should be good enough as the key
// because it should be updated with each "ClickableText" also we are referencing it inside pointerInput.
val pressIndicator = Modifier.pointerInput(currentLayoutResult.value) {
detectTapGestures(
onTap = { pos ->
currentLayoutResult.value?.let { layoutResult ->
Expand Down

0 comments on commit e4aeb14

Please sign in to comment.