I’ve encountered what sounds like the same issue i...
# compose
n
I’ve encountered what sounds like the same issue in a layout with a collapsing toolbar style behaviour. Dragging a lazyColumn uses a NestedScrollConnection to calculate an offset and change the height of the toolbar above. However, when a fling is performed that causes the toolbar to change in height and released as the view’s height is changing the NestedScrollConnection receives a high velocity fling in the opposite direction. My hypothesis is that the fling coordinates being processed by the LazyColumn are not being treated as absolute coords relative to the screen and so as the LazyColumn’s origin moves within its parent the gesture handler incorrectly generates another fling in the opposite direction. (code in thread)
Copy code
Example rough code:

var offset by remember { mutableStateOf(0f) }
val nestedScrollConnection = remember {
 object : NestedScrollConnection {
  override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
   val currentOffset = offset
   offset = (offset - available.y).coerceIn(0f, 200f)
   val delta = offset - currentOffset
   return Offset(x = 0f, y = -delta)
  }
 }
}

Column {
 Box(Modifier.fillMaxWidth().height((240f - offset).dp)
 Box(Modifier.nestedScroll(nestedScrollConnection) {
  LazyColumn(Modifier.fillMaxSize()) {
   ...
  }
 }
}
a
Known issue. Fix is on the way.
😪 1
😍 1