feat: add onRequestClose to ModalBottomSheet - #70
Open
DanyKrk wants to merge 55 commits into
Open
Conversation
Register Back and Escape handlers lazily when onRequestClose is first provided, then preserve their ordering by toggling eligibility instead of re-registering them. Reset registrations at structural host boundaries and add coverage for lifecycle changes, multiple sheets, predictive Back, and handler removal.
Supersede unfinished presses on a new initial key-down and retain short-lived tombstones so late events cannot finish the replacement.
Publish portal ownership and emission eligibility as a single state snapshot. Keep handlers stable while inactive portals yield new Back and Escape requests without retargeting input already in progress. Expand lifecycle, ownership, and controlled-dismissal coverage and update docs.
- remove redundant request-close handling updates - replace reflection-based assertions with explicit test snapshots - focus Robolectric coverage on platform-specific SDK paths - simplify bottom sheet rendering
…andler Forward Back to the host Activity and leave Escape in normal key routing when onRequestClose is omitted. Keep predictive Back actions pinned for the full gesture and ignore commits delivered after overlay teardown. Expand unit and instrumented coverage and update docs and examples.
Keep eligibility loss terminal for the current Escape sequence, even if the handler or modal state is restored before key-up. Reuse the shared dispatcher state for portal and native-overlay handling.
Keep portal and native-overlay presentations as close-input boundaries while visible close animations settle, consuming Back and Escape without emitting another onRequestClose. Unify request, consume, and pass-through transport states, stabilize predictive Back handling, and update tests, examples, and documentation.
DanyKrk
force-pushed
the
onRequestClose
branch
from
August 20, 2026 17:26
f1db99f to
4ec0487
Compare
DanyKrk
marked this pull request as draft
August 20, 2026 17:31
DanyKrk
force-pushed
the
onRequestClose
branch
from
August 24, 2026 13:41
bad433c to
8eebf23
Compare
- track closing presentation through a production state tracker - verify controllers through observable input routing and window flags - cover close-animation ownership with an instrumentation test
Rename request-close state, routing, lifecycle, and presentation symbols to reflect their actual responsibilities. Align the native bridge, tests, and documentation with the updated terminology.
Restore the host's current interaction state after the dialog's final window configuration so an already-open sheet does not remain invisible, unfocusable, or untouchable when moved into a native overlay. Cover the restored window flags and wait for real window focus before testing hardware Escape routing.
- focus public docs on observable onRequestClose behavior - clarify native routing comments and portal demo copy - generalize Android testing instructions
DanyKrk
marked this pull request as ready for review
September 1, 2026 12:12
Comment on lines
+77
to
+78
| implementation "androidx.activity:activity:1.8.2" | ||
| implementation "androidx.core:core:1.8.0" |
Collaborator
There was a problem hiding this comment.
Are 1.8.2 and 1.8.0 intended as minimum compatibility floors? They’re substantially behind the latest stable releases: 1.13.0 and 1.19.0, respectively. If this is intentional, let’s document it; otherwise, it would be good to update.
| @@ -0,0 +1,93 @@ | |||
| @file:Suppress("DEPRECATION", "OVERRIDE_DEPRECATION") | |||
Collaborator
There was a problem hiding this comment.
This seems redundant.
| @@ -0,0 +1,378 @@ | |||
| @file:Suppress("DEPRECATION", "OVERRIDE_DEPRECATION") | |||
Collaborator
There was a problem hiding this comment.
The OVERRIDE_DEPRECATION suppression is needed only for NoOpInstrumentedEventDispatcher.onCatalystInstanceDestroyed (line 377). Could we keep DEPRECATION here, explain that it’s for the legacy-architecture fixture, and move the OVERRIDE_DEPRECATION suppression onto the override of the aforementioned function?
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.
Summary
Adds an Android-only
onRequestClosecallback toModalBottomSheet, following React NativeModalsemantics as closely as practical.Android system Back, committed predictive Back gestures, and complete, unmodified physical-keyboard Escape presses now emit the same close-request event. The callback only reports the request: it does not change the controlled
index, select a detent, or dismiss the sheet. The consumer decides whether and how to close it.Behavior
onRequestClosehandler.Inline sheets, iOS, accessibility dismiss actions, scrim taps, drag gestures, and programmatic index changes keep their existing behavior.
Implementation
onRequestCloseprop, Fabric direct event, and native handler-presence signal.onRequestClosesemantics to portal andnativeOverlaypresentations.Test coverage
TESTING.md.