garthvh · GitHub

@garthvh

A sheet (or other presentation) is a new layout root, but PresentationRoot
left the presenter's `_scrollAxes` / `_layoutScrollAxes` in the environment.
When a sheet is presented from inside a ScrollView, expanding content in the
sheet is then sized with `IntrinsicSize.Max` — as if it were laid out in the
presenter's scroll direction (ComposeFlexibleContainer). For a sheet whose
content is a List (or any lazy container) that intrinsic pass crashes:
    java.lang.IllegalStateException: Asking for intrinsic measurements of
    SubcomposeLayout layouts is not supported.
and, before reaching the lazy content, the intrinsic constraint (maxHeight ==
Constraints.Infinity) also overflows IgnoresSafeAreaLayout's expansion
arithmetic:
    java.lang.IllegalArgumentException: maxWidth must be >= than minWidth
Reset both scroll-axis environment values at the presentation boundary so the
sheet lays out from a clean root, and guard IgnoresSafeAreaLayout's expansion
against the Infinity constraint the same way the existing
`constraint(_:subtracting:)` helper does (preserve Infinity, clamp to the
mins) so an intrinsic measurement can never overflow it.
Repro: present a sheet containing a List from a button inside a ScrollView;
it crashes on Android (fine on iOS). Related to skiptools#191.

Read the original on github.com ↗