feat: Add lazy prop to control mounting content before presentation - #792
Merged
Conversation
|
@maxlapides is attempting to deploy a commit to the lodev09 Team on Vercel. A member of the Team first needs to authorize it. |
maxlapides
marked this pull request as ready for review
August 23, 2026 00:33
maxlapides
force-pushed
the
mlapides/prewarm
branch
from
August 24, 2026 17:23
076f784 to
10b0dba
Compare
Owner
|
@maxlapides can we just name this to |
Per maintainer feedback, replace the prewarm prop with lazy (default
true) — lazy={false} mounts the sheet content before presentation.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
Yes, good idea @lodev09! I renamed it to |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Add a JS-only
lazyprop (defaulttrue). Settinglazy={false}mounts sheet children while the sheet remains unpresented. Keep the existing lazy behavior by default, begin rendering whenlazychanges tofalse, preserve mounted content when it changes back totrue, and keep non-lazy content mounted across dismissals. Do not forward the prop to the native component.Without this option, a sheet using
detents={['auto']}cannot mount its content beforepresent(). Content that starts with a Suspense fallback, asynchronous loading state, or skeleton can therefore present at the placeholder height and visibly resize when the final content arrives.Use
lazy={false}to mount content early, wait for the app's readiness signal such as Suspense resolution, loaded data, or settledonLayout, and then callpresent(). This lets the auto detent measure settled React Native content before the presentation animation begins.Document the new prop and its measurement limitation, add its public type, and cover the mounting and presentation lifecycle in unit tests.
Content that requires window attachment to measure, such as SwiftUI-hosted views rendered through
expo-ui, still measures only during presentation. React Native/Yoga content was verified to lay out fully while unpresented in a production React Native app on an iOS 26 simulator.Note
Originally proposed as a
prewarmprop; renamed tolazy={false}per maintainer feedback.Type of Change
Test Plan
yarn lintyarn typecheckyarn test— 69 tests passlazy={false}renders children while unpresented and when set after mountlazyand dismissing a non-lazy sheet preserve mounted childrenpresent()on a non-lazy sheet skips the additional mount waitlazyis not forwarded to the native componentScreenshots / Videos
N/A — this changes when hidden sheet content mounts and does not introduce a visible UI change.
Checklist