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:
Samuel Newman
2026-03-01 19:48:31 +02:00
parent 132c46817f
commit e46977ddca
3 changed files with 75 additions and 44 deletions
@@ -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}>