feat(iOS): implement unstable_sheetFooter for formSheet#4253
Open
birkir wants to merge 1 commit into
Open
Conversation
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
unstable_sheetFooteris currently Android-only —RNSScreenFooter.mmships as a stub with the positioning logic commented out. This PR implements the iOS side, mirroring the contract of Android'sScreenFooter: the footer overlays the sheet content, pinned to the bottom edge of the sheet, and lifts above the keyboard when one appears. Consumers reserve space for it (when desired) by padding their scroll content; since it overlays, it can also serve as a surface for blur / scroll-edge effects layered over the content.The abandoned constraint-based approach (the commented-out code) was replaced with frame pinning: Fabric assigns frames directly and fights Auto Layout, so the footer instead accepts Yoga's size and re-pins
origin.yafter every layout pass, from both directions:updateLayoutMetrics:— React-driven writes (footer content resize, state updates), andRNSScreenView'slayoutSubviews— UIKit-driven writes, which makes the footer track interactive detent drags natively sinceUISheetPresentationControllerresizes the presented view continuously during the gesture.Keyboard handling is the counterpart of Android's
WindowInsetsAnimationCompatcallback: the footer computes the keyboard's overlap with the sheet (converted through the window, so floating / centered iPad sheets get correct geometry) and animates with the keyboard's own duration and curve.Changes
ios/RNSScreenFooter.mm— implemented pinning, keyboard tracking,prepareForRecyclecleanup (replaces the stub).ios/RNSScreenFooter.h— exposedupdateFooterPosition.ios/RNSScreen.h/ios/RNSScreen.mm— addedfindSheetFooter(analogous tofindHeaderConfig) and alayoutSubviewsoverride onRNSScreenViewthat re-pins the footer during UIKit-driven resizes.src/types.tsx—@platform android→@platform android, iosonunstable_sheetFooter.guides/GUIDE_FOR_LIBRARY_AUTHORS.md— removed the Android-only note, documented the overlay contract.No new props, no codegen changes — the existing Fabric component registration is reused.
Test plan
apps/src/tests/issue-tests/TestScreenFooterKeyboardInsets.tsx— now exercisable on iOS.apps/src/tests/issue-tests/TestFormSheet.tsx— the commented-outunstable_sheetFooteroptions can be enabled on iOS.formSheetwithfitToContentsand detent arrays, footer pinned correctly at rest, during interactive detent drags, during sheet resize when footer content height changes, and above the keyboard; buttons at the sheet bottom remain tappable (frame-based pinning keeps UIKit hit-testing correct).Checklist