Bluesky app fork with some witchin' additions 💫

prevent lightbox initial jitter (#9762)

authored by samuel.fm and committed by

GitHub 277e985e 3b2573bc

+17 -19
+17 -19
src/view/com/lightbox/ImageViewing/index.tsx
··· 9 9 // https://github.com/jobtoday/react-native-image-viewing 10 10 11 11 import React, {useCallback, useEffect, useMemo, useState} from 'react' 12 - import {LayoutAnimation, PixelRatio, StyleSheet, View} from 'react-native' 12 + import { 13 + LayoutAnimation, 14 + PixelRatio, 15 + StyleSheet, 16 + useWindowDimensions, 17 + View, 18 + } from 'react-native' 13 19 import {SystemBars} from 'react-native-edge-to-edge' 14 20 import {Gesture} from 'react-native-gesture-handler' 15 21 import PagerView from 'react-native-pager-view' ··· 30 36 withSpring, 31 37 type WithSpringConfig, 32 38 } from 'react-native-reanimated' 33 - import { 34 - SafeAreaView, 35 - useSafeAreaFrame, 36 - useSafeAreaInsets, 37 - } from 'react-native-safe-area-context' 39 + import {SafeAreaView} from 'react-native-safe-area-context' 38 40 import * as ScreenOrientation from 'expo-screen-orientation' 39 41 import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' 40 42 import {Trans} from '@lingui/macro' ··· 427 429 } 428 430 } 429 431 430 - const safeFrameDelayedForJSThreadOnly = useSafeAreaFrame() 431 - const safeInsetsDelayedForJSThreadOnly = useSafeAreaInsets() 432 + const { 433 + width: widthDelayedForJSThreadOnly, 434 + height: heightDelayedForJSThreadOnly, 435 + } = useWindowDimensions() 432 436 const measureSafeArea = React.useCallback(() => { 433 437 'worklet' 434 438 let safeArea: Rect | null = measure(safeAreaRef) ··· 436 440 if (_WORKLET) { 437 441 console.error('Expected to always be able to measure safe area.') 438 442 } 439 - const frame = safeFrameDelayedForJSThreadOnly 440 - const insets = safeInsetsDelayedForJSThreadOnly 441 443 safeArea = { 442 - x: frame.x + insets.left, 443 - y: frame.y + insets.top, 444 - width: frame.width - insets.left - insets.right, 445 - height: frame.height - insets.top - insets.bottom, 444 + x: 0, 445 + y: 0, 446 + width: widthDelayedForJSThreadOnly, 447 + height: heightDelayedForJSThreadOnly, 446 448 } 447 449 } 448 450 return safeArea 449 - }, [ 450 - safeFrameDelayedForJSThreadOnly, 451 - safeInsetsDelayedForJSThreadOnly, 452 - safeAreaRef, 453 - ]) 451 + }, [safeAreaRef, heightDelayedForJSThreadOnly, widthDelayedForJSThreadOnly]) 454 452 455 453 const {thumbRect} = imageSrc 456 454 const transforms = useDerivedValue(() => {