Repository navigation
Conversation
This branch has not been deployed
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.
Motivation
useAnimatedLayoutseedscontainerHeightfrom the provider's container layout. When that container has not been measured yet, its height is stillINITIAL_LAYOUT_VALUE(-999), but for a modal with insets the initial state subtracts them anyway:-1061is no longer equal toINITIAL_LAYOUT_VALUE, soisLayoutCalculatedanduseAnimatedDetentstreat it as a real height. With dynamic sizing the detents become[0],animatedSheetHeightgoes negative, and the mount animation starts from those values. When the real height arrives a few ms later the detents correct themselves, but the sheet is left unpainted, with only the handle visible.It only happens when the sheet mounts before the
BottomSheetModalProvidercontainer has laid out, so it is timing dependent. We hit it with a provider mounted next to the sheet (the sheet is the whole UI of atransparentModalroute) withtopInset={insets.top}and dynamic sizing. Presenting while the JS thread was busy reproduced it on most attempts on iOS (26/27, new architecture). LogginganimatedLayoutStateandanimatedDetentsStatethroughuseBottomSheetInternalshowed every blank sheet starting withcontainerHeight: -1061, detents: [0]before812, [346.33], and every working one starting at812.The fix leaves
containerHeightatINITIAL_LAYOUT_VALUEuntil the container is measured. The existing reactions already skipINITIAL_LAYOUT_VALUEand apply the insets once the real height arrives, so a measured container behaves exactly as before. With the guard, the same flow rendered 8 of 8 times; without it, the blank sheet reproduced on most attempts.Minimal setup: