Skip to content

refactor(Android, FormSheet v5): Separate layout management for FormSheet#4256

Open
t0maboro wants to merge 7 commits into
@t0maboro/extract-lifecycle-coordinatorfrom
@t0maboro/dialog-manager-dimensions-coordinator
Open

refactor(Android, FormSheet v5): Separate layout management for FormSheet#4256
t0maboro wants to merge 7 commits into
@t0maboro/extract-lifecycle-coordinatorfrom
@t0maboro/dialog-manager-dimensions-coordinator

Conversation

@t0maboro

@t0maboro t0maboro commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

Following the extraction of the lifecycle coordinator, this PR further refactors the FormSheetDialogManager. All logic related to view dimensions and insets has been decoupled into dedicated coordinator.

Changes

  • Moved all insets handling, dynamic container height calculations, and dimension states into a dedicated coordinator. The main manager now only delegates the resolved detents to this class when the configuration changes.
  • Moved the translationY = height pre-draw setup to FormSheetAnimationCoordinator.prepareViewForAnimation - preparing the initial state of an animation is now explicitly handled on the animation layer.
  • disableMaterialInsetsAnimationCallback now is rewired to OnLayoutChangeListener, rather than relying on the OnPreDrawListener, which would run after calculating the layout, but the newly registered callback is more explicit regarding the intention.

Before & after - visual documentation

N/A - refactor

Test plan

Already existing SFTs.

Checklist

  • Included code example that can be used to test this change.
  • For visual changes, included screenshots / GIFs / recordings documenting the change.
  • For API changes, updated relevant public types.
  • Ensured that CI passes

@t0maboro t0maboro changed the base branch from main to @t0maboro/extract-lifecycle-coordinator July 3, 2026 07:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the Android FormSheet implementation by extracting view sizing/insets responsibilities out of FormSheetDialogManager into a dedicated coordinator, and clarifies animation setup responsibilities inside the animation layer.

Changes:

  • Introduces FormSheetDimensionsCoordinator to own window-insets handling, container height stabilization, and detent-driven sizing/behavior updates.
  • Moves the “initial offscreen position” setup (translationY = height) into FormSheetAnimationCoordinator.prepareViewForAnimation.
  • Rewires the Material insets-animation callback disabling to a layout-driven hook (instead of pre-draw) via the new coordinator.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetDimensionsCoordinator.kt New coordinator that centralizes insets + stable container height updates and detent application.
android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetDialogManager.kt Simplifies manager to delegate dimension/behavior concerns to the coordinator and animation prep to the animation coordinator.
android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetAnimationCoordinator.kt Adds prepareViewForAnimation to explicitly manage initial animation state setup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@t0maboro t0maboro changed the title refactor(Android, FormSheet): Separate layout management for FormSheet refactor(Android, FormSheet v5): Separate layout management for FormSheet Jul 3, 2026
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.

2 participants