Add height constraint to full-height bottom sheets (#11178)
(cherry picked from commit 0f27fdda65)
This commit is contained in:
@@ -146,6 +146,7 @@ function BottomSheetNativeComponentInner({
|
|||||||
const insets = useSafeAreaInsets()
|
const insets = useSafeAreaInsets()
|
||||||
const cornerRadius = rest.cornerRadius ?? 0
|
const cornerRadius = rest.cornerRadius ?? 0
|
||||||
const {height: screenHeight} = useWindowDimensions()
|
const {height: screenHeight} = useWindowDimensions()
|
||||||
|
const isHeightConstrained = maxHeight != null || rest.fullHeight === true
|
||||||
|
|
||||||
// sigh... on older Android versions, screenHeight does not include safe area insets
|
// sigh... on older Android versions, screenHeight does not include safe area insets
|
||||||
// on newer Androids + iOS, it does. we need to find the inner bit + the bottom inset
|
// on newer Androids + iOS, it does. we need to find the inner bit + the bottom inset
|
||||||
@@ -182,7 +183,7 @@ function BottomSheetNativeComponentInner({
|
|||||||
]}>
|
]}>
|
||||||
<View
|
<View
|
||||||
onLayout={onLayout}
|
onLayout={onLayout}
|
||||||
style={maxHeight == null ? undefined : {flex: 1}}>
|
style={isHeightConstrained ? {flex: 1} : undefined}>
|
||||||
<BottomSheetPortalProvider>{children}</BottomSheetPortalProvider>
|
<BottomSheetPortalProvider>{children}</BottomSheetPortalProvider>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -157,7 +157,8 @@ export function Outer({
|
|||||||
[open, close],
|
[open, close],
|
||||||
)
|
)
|
||||||
|
|
||||||
const isHeightConstrained = nativeOptions?.maxHeight != null
|
const isHeightConstrained =
|
||||||
|
nativeOptions?.maxHeight != null || nativeOptions?.fullHeight === true
|
||||||
|
|
||||||
const context = useMemo(
|
const context = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user