fix android bottom sheet height observation and content clipping
- getContentHeight: use max of children heights instead of DFS index 1 (old approach measured the drag handle, not the content) - observe height via OnLayoutChangeListener on each direct child instead of OnGlobalLayoutListener (RN bypasses requestLayout, so global listener never fires for RN-driven layout changes) - defer state changes during DRAGGING/SETTLING to avoid interrupting dismiss swipes, apply when gesture settles - subtract insets.top from NativeView height on android (matching iOS) to prevent scroll content clipping at bottom of full-height sheets Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,6 @@ import {
|
||||
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
||||
import {requireNativeModule, requireNativeViewManager} from 'expo-modules-core'
|
||||
|
||||
import {IS_IOS} from '#/env'
|
||||
import {
|
||||
type BottomSheetState,
|
||||
type BottomSheetViewProps,
|
||||
@@ -145,8 +144,6 @@ function BottomSheetNativeComponentInner({
|
||||
const cornerRadius = rest.cornerRadius ?? 0
|
||||
const {height: screenHeight} = useWindowDimensions()
|
||||
|
||||
const sheetHeight = IS_IOS ? screenHeight - insets.top : screenHeight
|
||||
|
||||
return (
|
||||
<NativeView
|
||||
{...rest}
|
||||
@@ -154,7 +151,7 @@ function BottomSheetNativeComponentInner({
|
||||
ref={nativeViewRef}
|
||||
style={{
|
||||
position: 'absolute',
|
||||
height: sheetHeight,
|
||||
height: screenHeight - insets.top,
|
||||
width: '100%',
|
||||
}}
|
||||
containerBackgroundColor={backgroundColor}>
|
||||
|
||||
Reference in New Issue
Block a user