fix first sheet height change not registering (#8267)

This commit is contained in:
Samuel Newman
2025-04-22 21:49:20 +03:00
committed by GitHub
parent dba0bd8379
commit b1550f9c02
3 changed files with 11 additions and 7 deletions
+2 -1
View File
@@ -144,7 +144,8 @@ class SheetView: ExpoView, UISheetPresentationControllerDelegate {
} }
func updateLayout() { func updateLayout() {
if self.prevLayoutDetentIdentifier == self.selectedDetentIdentifier, // Allow updates either when identifiers match OR when prevLayoutDetentIdentifier is nil (first real content update)
if (self.prevLayoutDetentIdentifier == self.selectedDetentIdentifier || self.prevLayoutDetentIdentifier == nil),
let contentHeight = self.innerView?.subviews.first?.frame.size.height { let contentHeight = self.innerView?.subviews.first?.frame.size.height {
self.sheetVc?.updateDetents(contentHeight: self.clampHeight(contentHeight), self.sheetVc?.updateDetents(contentHeight: self.clampHeight(contentHeight),
preventExpansion: self.preventExpansion) preventExpansion: self.preventExpansion)
@@ -1,18 +1,21 @@
import * as React from 'react' import * as React from 'react'
import { import {
Dimensions, Dimensions,
LayoutChangeEvent, type LayoutChangeEvent,
NativeSyntheticEvent, type NativeSyntheticEvent,
Platform, Platform,
StyleProp, type StyleProp,
View, View,
ViewStyle, type ViewStyle,
} from 'react-native' } from 'react-native'
import {useSafeAreaInsets} from 'react-native-safe-area-context' import {useSafeAreaInsets} from 'react-native-safe-area-context'
import {requireNativeModule, requireNativeViewManager} from 'expo-modules-core' import {requireNativeModule, requireNativeViewManager} from 'expo-modules-core'
import {isIOS} from '#/platform/detection' import {isIOS} from '#/platform/detection'
import {BottomSheetState, BottomSheetViewProps} from './BottomSheet.types' import {
type BottomSheetState,
type BottomSheetViewProps,
} from './BottomSheet.types'
import {BottomSheetPortalProvider} from './BottomSheetPortal' import {BottomSheetPortalProvider} from './BottomSheetPortal'
import {Context as PortalContext} from './BottomSheetPortal' import {Context as PortalContext} from './BottomSheetPortal'
@@ -1,4 +1,4 @@
import {BottomSheetViewProps} from './BottomSheet.types' import {type BottomSheetViewProps} from './BottomSheet.types'
export function BottomSheetNativeComponent(_: BottomSheetViewProps) { export function BottomSheetNativeComponent(_: BottomSheetViewProps) {
throw new Error('BottomSheetNativeComponent is not available on web') throw new Error('BottomSheetNativeComponent is not available on web')