refactor(Android, FormSheet v5): Separate layout management for FormSheet#4256
Open
t0maboro wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
FormSheetDimensionsCoordinatorto own window-insets handling, container height stabilization, and detent-driven sizing/behavior updates. - Moves the “initial offscreen position” setup (
translationY = height) intoFormSheetAnimationCoordinator.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
translationY = heightpre-draw setup toFormSheetAnimationCoordinator.prepareViewForAnimation- preparing the initial state of an animation is now explicitly handled on the animation layer.disableMaterialInsetsAnimationCallbacknow is rewired toOnLayoutChangeListener, rather than relying on theOnPreDrawListener, 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