feat(swmansion): apply keyboardBehavior="inset" to fixed-height sheets#29
Merged
Merged
Conversation
Previously the keyboard inset was gated to content-sized sheets (`!shouldFill`), so `keyboardBehavior="inset"` was a no-op on numeric-detent / fullHeight sheets. Now it applies to every sheet size: content-sized sheets re-measure taller, while fixed-height ones shrink their scroll area above the keyboard (the inset wrapper already carries fillStyle / flex:1). Docs updated with a dedicated Keyboard avoidance section and inset vs none guidance.
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.
What
keyboardBehavior="inset"previously only worked on content-sized sheets — it was gated byneedsKeyboardInset = keyboardBehavior === 'inset' && !shouldFill, so on numeric-detent /fullHeightsheets it was a silent no-op.This drops the
!shouldFillgate so'inset'applies to every sheet size:detents/fullHeight) → the content area shrinks by the keyboard height, so a scrollable child scrolls within the remaining space above the keyboard.The inset wrapper already received
fillStyle(flex: 1), so fixed-height content shrinks correctly with no further change.Why
Consumers with full-height sheets had to hand-roll keyboard avoidance (nesting a keyboard-aware scrollable), which then double-lifted content on content-sized sheets. With
'inset'working uniformly, the sheet owns keyboard avoidance for all sizes and the content stays a plain scrollable.Docs
built-in-adapters/swmansion.mdgets a dedicated Keyboard avoidance section: how'inset'adapts per sheet size, when to use'inset'vs'none', and the rule that the two are exclusive (never nest a keyboard-aware scrollable inside an'inset'sheet).