import React from 'react'; import { StyleSheet } from 'react-native'; import Animated, { useSharedValue, useAnimatedGestureHandler, useAnimatedStyle, withSpring, } from 'react-native-reanimated'; import { GestureHandlerRootView, PinchGestureHandler, PinchGestureHandlerGestureEvent, } from 'react-native-gesture-handler'; const ZoomableImage = () => { const scale = useSharedValue(1); // Scale state // Gesture Handler const pinchHandler = useAnimatedGestureHandler({ onActive: (event) => { scale.value = Math.max(1, Math.min(event.scale, 3)); // Restrict scale }, onEnd: () => { scale.value = withSpring(1); // Reset smoothly }, }); // Animated Style const animatedStyle = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }], })); return ( ); }; const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#000', }, animatedContainer: { width: 300, height: 300, }, image: { width: '100%', height: '100%', }, }); export default ZoomableImage;