Migrate away from StyleSheet.absoluteFill and StyleSheet.absoluteFillObject

This commit is contained in:
Tomek Zawadzki
2026-07-29 23:04:06 +02:00
committed by Oleksii Bulenok
parent b5540bffab
commit 46091e5fc7
3 changed files with 11 additions and 10 deletions
+5 -4
View File
@@ -2,7 +2,6 @@ import {forwardRef, useCallback, useEffect, useState} from 'react'
import { import {
AccessibilityInfo, AccessibilityInfo,
Image as RNImage, Image as RNImage,
StyleSheet,
useColorScheme, useColorScheme,
View, View,
} from 'react-native' } from 'react-native'
@@ -20,6 +19,7 @@ import {Image} from 'expo-image'
import * as SplashScreen from 'expo-splash-screen' import * as SplashScreen from 'expo-splash-screen'
import {Logotype} from '#/view/icons/Logotype' import {Logotype} from '#/view/icons/Logotype'
import {atoms as a} from '#/alf'
// @ts-ignore // @ts-ignore
import splashImagePointer from '../assets/splash/splash.png' import splashImagePointer from '../assets/splash/splash.png'
// @ts-ignore // @ts-ignore
@@ -170,12 +170,12 @@ export function Splash(props: React.PropsWithChildren<Props>) {
return ( return (
<View style={{flex: 1}} onLayout={onLayout}> <View style={{flex: 1}} onLayout={onLayout}>
{!isAnimationComplete && ( {!isAnimationComplete && (
<View style={StyleSheet.absoluteFillObject}> <View style={[a.absolute, a.inset_0]}>
<Image <Image
accessibilityIgnoresInvertColors accessibilityIgnoresInvertColors
onLoadEnd={onLoadEnd} onLoadEnd={onLoadEnd}
source={{uri: isDarkMode ? darkSplashImageUri : splashImageUri}} source={{uri: isDarkMode ? darkSplashImageUri : splashImageUri}}
style={StyleSheet.absoluteFillObject} style={[a.absolute, a.inset_0]}
/> />
<Animated.View <Animated.View
@@ -205,7 +205,8 @@ export function Splash(props: React.PropsWithChildren<Props>) {
{!isAnimationComplete && ( {!isAnimationComplete && (
<Animated.View <Animated.View
style={[ style={[
StyleSheet.absoluteFillObject, a.absolute,
a.inset_0,
logoAnimation, logoAnimation,
{ {
flex: 1, flex: 1,
@@ -1,5 +1,5 @@
import {useCallback, useState} from 'react' import {useCallback, useState} from 'react'
import {Pressable, StyleSheet, useWindowDimensions, View} from 'react-native' import {Pressable, useWindowDimensions, View} from 'react-native'
import {useSafeAreaInsets} from 'react-native-safe-area-context' import {useSafeAreaInsets} from 'react-native-safe-area-context'
import Svg, {Path} from 'react-native-svg' import Svg, {Path} from 'react-native-svg'
import { import {
@@ -125,7 +125,7 @@ export function InviteScannerScreen() {
noInsetTop noInsetTop
style={{backgroundColor: t.palette.black}}> style={{backgroundColor: t.palette.black}}>
<CameraView <CameraView
style={StyleSheet.absoluteFill} style={[a.absolute, a.inset_0]}
facing="back" facing="back"
barcodeScannerSettings={{barcodeTypes: ['qr']}} barcodeScannerSettings={{barcodeTypes: ['qr']}}
onBarcodeScanned={scannerEnabled ? onBarcodeScanned : undefined} onBarcodeScanned={scannerEnabled ? onBarcodeScanned : undefined}
@@ -254,7 +254,7 @@ function ScannerScrim() {
`V${y + r} A${r} ${r} 0 0 1 ${x + r} ${y} Z` `V${y + r} A${r} ${r} 0 0 1 ${x + r} ${y} Z`
return ( return (
<Svg <Svg
style={StyleSheet.absoluteFill} style={[a.absolute, a.inset_0]}
width={width} width={width}
height={height} height={height}
pointerEvents="none"> pointerEvents="none">
@@ -1,5 +1,5 @@
import {useMemo, useState} from 'react' import {useMemo, useState} from 'react'
import {type ColorValue, Dimensions, StyleSheet, View} from 'react-native' import {type ColorValue, Dimensions, View} from 'react-native'
import {Gesture, GestureDetector} from 'react-native-gesture-handler' import {Gesture, GestureDetector} from 'react-native-gesture-handler'
import Animated, { import Animated, {
clamp, clamp,
@@ -16,6 +16,7 @@ import Animated, {
import {scheduleOnRN} from 'react-native-worklets' import {scheduleOnRN} from 'react-native-worklets'
import {useHaptics} from '#/lib/haptics' import {useHaptics} from '#/lib/haptics'
import {atoms as a} from '#/alf'
import {type GestureActions} from './GestureActionView.shared' import {type GestureActions} from './GestureActionView.shared'
const MAX_WIDTH = Dimensions.get('screen').width const MAX_WIDTH = Dimensions.get('screen').width
@@ -287,8 +288,7 @@ export function GestureActionView({
return ( return (
<GestureDetector gesture={composedGesture}> <GestureDetector gesture={composedGesture}>
<View> <View>
<Animated.View <Animated.View style={[a.absolute, a.inset_0, animatedBackgroundStyle]}>
style={[StyleSheet.absoluteFill, animatedBackgroundStyle]}>
<View <View
style={{ style={{
flex: 1, flex: 1,