Use dimensions hook

This commit is contained in:
Eric Bailey
2025-06-23 13:26:10 -05:00
parent d7a644e759
commit 5c552be275
+4 -3
View File
@@ -7,7 +7,7 @@ import {
useRef,
useState,
} from 'react'
import {Dimensions, View} from 'react-native'
import {useWindowDimensions, View} from 'react-native'
import Animated, {Easing, ZoomIn} from 'react-native-reanimated'
import {useSafeAreaInsets} from 'react-native-safe-area-context'
@@ -185,6 +185,7 @@ function Bubble({
}) {
const t = useTheme()
const insets = useSafeAreaInsets()
const dimensions = useWindowDimensions()
const [bubbleMeasurements, setBubbleMeasurements] = useState<
| {
width: number
@@ -203,7 +204,7 @@ function Bubble({
tipLeft: 0,
}
const {width: ww, height: wh} = Dimensions.get('window')
const {width: ww, height: wh} = dimensions
const maxTop = insets.top
const maxBottom = wh - insets.bottom
const {width: cw, height: ch} = bubbleMeasurements
@@ -273,7 +274,7 @@ function Bubble({
tipTop,
tipLeft,
}
}, [position, targetMeasurements, bubbleMeasurements, insets])
}, [position, targetMeasurements, bubbleMeasurements, insets, dimensions])
const requestCloseWrapped = useCallback(() => {
setBubbleMeasurements(undefined)