onebone/compose-collapsing-toolbar

CollapsingToolbarScaffold's body height is incorrect when restored from saved state with `ExitUntilCollapsed` scrolling strategy

Opened this issue · 2 comments

Summary

When using the ExitUntilCollapsed scrolling strategy, the height of the CollapsingToolbarScaffold's body is calculated incorrectly when it is restored from saved state after being killed in the background.

Replication steps

  1. Update the sample app to use the ExitUntilCollapsed scrolling strategy
  2. Open the sample app
  3. Scroll all the way down to the bottom of the list
  4. Background the app
  5. Kill the app while in the background via ADB: adb shell am kill me.onebone.toolbar
  6. Reopen the app to trigger state restoration
  • Expected behaviour: the list is scrolled all the way to the bottom
  • Actual behaviour: the last few elements of the list are obfuscated and it is not possible to scroll further down to reveal them

Additional notes

The issue "fixes itself" if you scroll all the way up and then down again.

Root cause

Measuring the CollapsingToolbarScaffold's toolbar updates the CollapsingToolbarState, which CollapsingToolbarScaffold's body measurement constraints depend on. Therefore the toolbar must be measured before the body measurement constraints are calculated.

Screen recording

Screen_recording_20231019_214440.mp4

Hi there, I'm experiencing a similar issue. Do you think we could proceed with a release incorporating this change?

Any updates? same issue