This commit is contained in:
Samuel Newman
2026-01-26 15:01:45 +02:00
parent 85fb3b8df0
commit afd254157a
3 changed files with 13 additions and 21 deletions
@@ -1,4 +1,4 @@
import React, {useState} from 'react' import {memo, useState} from 'react'
import {ActivityIndicator, StyleSheet} from 'react-native' import {ActivityIndicator, StyleSheet} from 'react-native'
import { import {
Gesture, Gesture,
@@ -472,4 +472,4 @@ function withClampedSpring(value: any) {
return withSpring(value, {overshootClamping: true}) return withSpring(value, {overshootClamping: true})
} }
export default React.memo(ImageItem) export default memo(ImageItem)
@@ -6,8 +6,8 @@
* *
*/ */
import React, {useState} from 'react' import {memo, useState} from 'react'
import {ActivityIndicator, StyleSheet} from 'react-native' import {ActivityIndicator} from 'react-native'
import { import {
Gesture, Gesture,
GestureDetector, GestureDetector,
@@ -26,6 +26,7 @@ import Animated, {
import {useSafeAreaFrame} from 'react-native-safe-area-context' import {useSafeAreaFrame} from 'react-native-safe-area-context'
import {Image} from 'expo-image' import {Image} from 'expo-image'
import {atoms as a} from '#/alf'
import { import {
type Dimensions as ImageDimensions, type Dimensions as ImageDimensions,
type ImageSource, type ImageSource,
@@ -230,7 +231,11 @@ const ImageItem = ({
animatedProps={scrollViewProps} animatedProps={scrollViewProps}
centerContent> centerContent>
{showLoader && ( {showLoader && (
<ActivityIndicator size="small" color="#FFF" style={styles.loading} /> <ActivityIndicator
size="small"
color="#FFF"
style={[a.absolute, a.inset_0]}
/>
)} )}
<Animated.View style={imageCropStyle}> <Animated.View style={imageCropStyle}>
<Animated.View style={imageStyle}> <Animated.View style={imageStyle}>
@@ -261,19 +266,6 @@ const ImageItem = ({
) )
} }
const styles = StyleSheet.create({
loading: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
},
image: {
flex: 1,
},
})
const getZoomRectAfterDoubleTap = ( const getZoomRectAfterDoubleTap = (
imageAspect: number | undefined, imageAspect: number | undefined,
touchX: number, touchX: number,
@@ -363,4 +355,4 @@ const getZoomRectAfterDoubleTap = (
} }
} }
export default React.memo(ImageItem) export default memo(ImageItem)
@@ -1,6 +1,6 @@
// default implementation fallback for web // default implementation fallback for web
import React from 'react' import {memo} from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {type PanGesture} from 'react-native-gesture-handler' import {type PanGesture} from 'react-native-gesture-handler'
import {type SharedValue} from 'react-native-reanimated' import {type SharedValue} from 'react-native-reanimated'
@@ -44,4 +44,4 @@ const ImageItem = (_props: Props) => {
return <View /> return <View />
} }
export default React.memo(ImageItem) export default memo(ImageItem)