Skip to content

Commit

Permalink
fix: wrong pointerInput invoked on scroll inside message list [WPB-35…
Browse files Browse the repository at this point in the history
…25] (#2022)

Co-authored-by: Mateusz <m.pachulski94@gmail.com>
Co-authored-by: Vitor Hugo Schwaab <vitor@schwaab.dev>
Co-authored-by: Tommaso Piazza <196761+tmspzz@users.noreply.github.com>
  • Loading branch information
4 people committed Jul 31, 2023
1 parent 1244ad5 commit f2182c9
Showing 1 changed file with 5 additions and 1 deletion.
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 f2182c9

Please sign in to comment.