Skip to content

refactor(Android, FormSheet v5): Introduce invalidation flags for updates#4262

Open
t0maboro wants to merge 3 commits into
@t0maboro/formsheet-presentation-managerfrom
@t0maboro/formsheet-android-invalidation-flags
Open

refactor(Android, FormSheet v5): Introduce invalidation flags for updates#4262
t0maboro wants to merge 3 commits into
@t0maboro/formsheet-presentation-managerfrom
@t0maboro/formsheet-android-invalidation-flags

Conversation

@t0maboro

@t0maboro t0maboro commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

Following the iOS architecture (which has distinct Presentation, Appearance, and Behavior providers along with update flags), this PR introduces an InvalidationFlags for FormSheetDialogManager on Android.

Instead of applying configuration changes when props change, the applyConfig method now evaluates what changed, raises the appropriate flags, and defers the actual execution to a coordinated flushPendingUpdates pass.

Note: as for iOS, reopening the sheet automatically invalidates both Appearance and Behavior. This ensures the native BottomSheetBehavior and layout are strictly synchronized with the React Native state, preventing stale configurations on re-mounts.

Changes

  • Introduced FormSheetInvalidationFlags
  • Replaced immediate actions with a state-diffing approach.
  • All changes are now executed via flushPendingUpdates

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 FormSheetDialogManager update flow to mirror the iOS “diff + invalidate + flush” architecture, introducing explicit invalidation flags and deferring all work into a single coordinated flushPendingUpdates() pass.

Changes:

  • Added FormSheetInvalidationFlags to track presentation/appearance/behavior invalidations.
  • Refactored applyConfig to compute invalidations instead of performing immediate side effects.
  • Centralized update execution into flushPendingUpdates() with dedicated update helpers.

Reviewed changes

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

File Description
android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetInvalidationFlags.kt Adds a new invalidation-flags holder for coordinating updates.
android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetDialogManager.kt Switches from immediate updates to invalidation + flush-based update execution.

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

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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