Skip to content

Conversation

kkafar
Copy link
Member

@kkafar kkafar commented Mar 14, 2025

Description

On each fragment reattachment we reconfigure the behaviour, but we do not keep the state.
Each time we use sheetInitialDetentIndex instead of the last stable detent index.

Changes

This PR moves sheet configuration to SheetDelegate to declutter ScreenStackFragment & uses appropriate value during configuration.

Lifecycle of the SheetDelegate is tied to the fragment, therefore on fragment recreation (not reattachment) the state still will be lost.

Recordings

Note

There still is no animation when navigating from formSheet to push in the same stack, but it is separate issue (already WIP to handle this).

before after
Screen.Recording.2025-03-14.at.21.00.12.mov
Screen.Recording.2025-03-14.at.20.58.50.mov

Test code and steps to reproduce

TestFormSheet

  1. navigate to sheet
  2. expand it
  3. navigate to "second"
  4. go back
  5. observe that sheet stays in expanded state

Checklist

  • Ensured that CI passes

kkafar added 5 commits March 14, 2025 20:46
SheetDelegate

The sheet must be configured in `onCreateView`, because
`onAttachedToWindow` is called before `onViewCreated` for
reattached fragments and apparently some behaviour code runs,
because later configuration is not reflected on screen immediately.

I also need the sheet delegate to be created & initialized before
the behaviour is configured. Therefore I'm splitting creation &
configuration into two phases and also moving configuration code
to the delegate to unclutter `ScreenStackFragment`.`
@kkafar kkafar force-pushed the @kkafar/formsheet-savestate-laststabledetentindex-2 branch from d99de24 to fb95f69 Compare March 14, 2025 19:47
@kkafar kkafar merged commit ffd1583 into main Mar 14, 2025
4 checks passed
@kkafar kkafar deleted the @kkafar/formsheet-savestate-laststabledetentindex-2 branch March 14, 2025 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant