Repository navigation
feat(lynx): render formSheet routes - #16
Merged
Merged
Conversation
`presentation: 'formSheet'` was accepted by the types and then thrown on, so the option could not be used. It now renders. The shape follows the native stack's own draft of this architecture on `@satya164/native-stack`, which already has a `SheetScreen` beside the `CardScreen` and `NativeStackViewState` this package mirrors: - A native sheet is its own host rather than a screen inside the stack, so sheets render as siblings of the stack host. - `isOpen` follows focus. A sheet covered by a pushed card has to close, so keying it off whether the route was popped would leave it open underneath. - `fitToContents` must not be handed a full-height content view, or the native side has nothing to measure. - The popped route is dropped in `onDidDisappear`, which is what gives the sheet something to animate out. - `onNativeDismiss` carries whether the route was really dismissed. `ADD_NATIVELY_DISMISSED_ROUTES` must not fire for a sheet whose dismissal was prevented, because that screen is still on the native stack. Two guards come with it: an unsupported `presentation` now says so instead of silently rendering a card, and a `formSheet` as the first route is rejected - it has nothing to present over. Option names follow `@react-navigation/native-stack`. Three of its sheet options have no counterpart on `FormSheetProps` and are left out rather than faked: `sheetSelectedDetentIndex`, `preventNativeDismissDragFeedback`, and `preventNativeDismiss` as a channel array, which is a boolean here. `sheetDetentChange` carries only the index; upstream also reports whether the detent is stable, which `onDetentChanged` does not provide. `preventNativeDismiss` is read from `usePreventRemove` rather than screen options, matching `CardScreen`: `onNativeDismissPrevented` pops unconditionally, so a static option would have the native side block the gesture and the round-trip pop the route anyway. The example gains a sheet with two detents that logs where it settles.
🦋 Changeset detectedLatest commit: 4a84762 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
presentation: 'formSheet'was accepted by the types and then thrown on, so the option could not be used. It now renders.The shape follows the native stack's own draft of this architecture on
@satya164/native-stack(#13115), which already has aSheetScreenbeside theCardScreenandNativeStackViewStatethis package mirrors:isOpenfollows focus — a sheet covered by a pushed card has to close.fitToContentsmust not be handed a full-height content view, or the native side has nothing to measure.onDidDisappear, which is what gives the sheet something to animate out.onNativeDismisscarries whether the route was really dismissed, soADD_NATIVELY_DISMISSED_ROUTESdoes not fire for a sheet whose dismissal was prevented.Two guards come with it: an unsupported
presentationnow says so instead of silently rendering a card, and aformSheetas the first route is rejected.Option names follow
@react-navigation/native-stack. Three of its sheet options have no counterpart onFormSheetPropsand are left out rather than faked:sheetSelectedDetentIndex,preventNativeDismissDragFeedback, andpreventNativeDismissas a channel array, which is a boolean here.sheetDetentChangecarries only the index; upstream also reports whether the detent is stable, whichonDetentChangeddoes not provide.preventNativeDismissis read fromusePreventRemoverather than screen options, matchingCardScreen:onNativeDismissPreventedpops unconditionally, so a static option would have the native side block the gesture and the round-trip pop the route anyway. Supporting it means guarding that dispatch, which changes cards too.Not yet verified on a device — the example gains a sheet with two detents that logs where it settles, and that is the next step.