feat(Android, FormSheet v5): Add onDetentChanged support#4292
Open
t0maboro wants to merge 6 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Android support for the FormSheet onDetentChanged event (already present on iOS), emitting the newly settled detent index to JS, and introduces a Single Feature Test (SFT) scenario to validate the behavior.
Changes:
- Android: wired a new
FormSheetDetentChangedEventthrough the host view manager/emitter chain and mappedBottomSheetBehaviorstate changes to detent indices. - JS/Types: updated
FormSheetprop docs to reflect cross-platform availability. - Apps (SFT): added an
onDetentChangedtest scenario and made it available on both Android and iOS.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/components/gamma/modals/form-sheet/FormSheet.types.ts | Removes the iOS-only platform annotation for onDetentChanged to reflect Android support. |
| apps/src/tests/single-feature-tests/form-sheet/test-form-sheet-on-detent-changed/scenario.md | Adds manual test instructions for verifying onDetentChanged. |
| apps/src/tests/single-feature-tests/form-sheet/test-form-sheet-on-detent-changed/scenario-description.ts | Registers the new SFT scenario metadata for Android + iOS. |
| apps/src/tests/single-feature-tests/form-sheet/test-form-sheet-on-detent-changed/index.tsx | Implements the test screen that displays the active detent index based on onDetentChanged. |
| apps/src/tests/single-feature-tests/form-sheet/index.ts | Exposes the new scenario from the form-sheet SFT index. |
| android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetHostViewManager.kt | Exports the new direct event registration info for onDetentChanged. |
| android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetHostEventEmitter.kt | Adds an emitter method to dispatch detent change events to JS. |
| android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetHost.kt | Wires dialog detent changes to the React event emitter. |
| android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetDialogManager.kt | Passes the detent change callback into the behavior controller and manages callback lifecycle. |
| android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetDetentChangedEvent.kt | Introduces the Android event payload for detent index changes. |
| android/src/main/java/com/swmansion/rnscreens/gamma/modals/formsheet/FormSheetBehaviorController.kt | Listens to BottomSheet state changes and maps them to detent indices for event emission. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
onDetentChanged supportonDetentChanged support
ce2e09c to
abd49b0
Compare
Base automatically changed from
@t0maboro/formsheet-lifecycle-events-android
to
main
July 9, 2026 12:33
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
f61e1fe to
49ce734
Compare
onDetentChanged supportonDetentChanged support
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
This PR introduces support for the
onDetentChangedevent in the FormSheet. It reports the index of the newly settled detent.Closes: https://github.com/software-mansion/react-native-screens-labs/issues/1561
Changes
FormSheetBehaviorControllersafely translates these states into the corresponding detents array index depending on the current detent count configuration.FormSheetDetentChangedEventwith JSBefore & after - visual documentation
detent-change.mov
Test plan
Marked SFT as applicable on Android.
Checklist