Skip to content

refactor(Android, FormSheet v5): Extract FormSheetLifecycleCoordinator for cleaner dialog event handling#4252

Open
t0maboro wants to merge 3 commits into
@t0maboro/android-formsheet-detents-2from
@t0maboro/extract-lifecycle-coordinator
Open

refactor(Android, FormSheet v5): Extract FormSheetLifecycleCoordinator for cleaner dialog event handling#4252
t0maboro wants to merge 3 commits into
@t0maboro/android-formsheet-detents-2from
@t0maboro/extract-lifecycle-coordinator

Conversation

@t0maboro

@t0maboro t0maboro commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

Part 1 for refactoring FormSheetDialogManager architecture on Android. This PR extracts the native dialog lifecycle management into a dedicated class.

Changes

  • moving onShow, onDismiss, and backdrop click handling to register on FormSheetLifecycleCoordinator level

Before & after - visual documentation

N/A - refactor

Test plan

N/A - refactor

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

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

This PR refactors the Android FormSheet (v5) implementation by extracting dialog lifecycle event wiring (show/cancel/backdrop click) from FormSheetDialogManager into a dedicated FormSheetLifecycleCoordinator, aiming to simplify responsibilities and improve maintainability.

Changes:

  • Introduced FormSheetLifecycleCoordinator to centralize BottomSheetDialog show/cancel handling and dimming backdrop click wiring.
  • Updated FormSheetDialogManager to delegate lifecycle listener setup/teardown to the new coordinator.
  • Removed now-redundant private listener-setup methods from FormSheetDialogManager.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetLifecycleCoordinator.kt New coordinator class encapsulating dialog show/cancel + backdrop click listener management.
android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetDialogManager.kt Delegates lifecycle listener responsibilities to the new coordinator and removes duplicated logic.

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

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