import {RouteProp} from '@react-navigation/core'; import {StackNavigationProp} from '@react-navigation/stack'; import React, {useEffect, useState} from 'react'; import { Dimensions, Image, StyleSheet, TouchableOpacity, Alert, } from 'react-native'; import {normalize} from 'react-native-elements'; import ImageZoom from 'react-native-image-pan-zoom'; import CloseIcon from '../../assets/ionicons/close-outline.svg'; import {MainStackParams} from '../../routes'; import {HeaderHeight, SCREEN_WIDTH, SCREEN_HEIGHT} from '../../utils'; import {TaggSquareButton} from '../common'; type ZoomInCropperRouteProps = RouteProp; type ZoomInCropperNavigationProps = StackNavigationProp< MainStackParams, 'ZoomInCropper' >; interface ZoomInCropperProps { route: ZoomInCropperRouteProps; navigation: ZoomInCropperNavigationProps; } export const ZoomInCropper: React.FC = ({ route, navigation, }) => { const {screenType, title, image} = route.params; const [aspectRatio, setAspectRatio] = useState(1); useEffect(() => { navigation.dangerouslyGetParent()?.setOptions({ tabBarVisible: false, }); }, []); useEffect(() => { if (image.sourceURL) { Image.getSize( image.sourceURL, (w, h) => { setAspectRatio(w / h); }, (err) => console.log(err), ); } }, []); return ( <> navigation.goBack()}> console.log( 'hi', position.positionX, position.positionY, position.scale, position.zoomCurrentDistance, SCREEN_WIDTH, SCREEN_HEIGHT, ) }> { if (image && image.filename && image.sourceURL) { navigation.navigate('CaptionScreen', { screenType, title: title, image: {filename: image.filename, path: image.sourceURL}, }); } else { Alert.alert('Invalid image file.'); } }} title={'Next'} buttonStyle={'normal'} buttonColor={'blue'} labelColor={'white'} style={styles.button} labelStyle={styles.buttonLabel} /> ); }; const styles = StyleSheet.create({ closeButton: { position: 'absolute', top: 0, paddingTop: HeaderHeight, zIndex: 1, marginLeft: '5%', }, button: { zIndex: 1, position: 'absolute', bottom: normalize(20), right: normalize(15), width: normalize(108), height: normalize(25), borderRadius: 10, }, buttonLabel: { fontWeight: '700', fontSize: normalize(15), lineHeight: normalize(17.8), letterSpacing: normalize(1.3), textAlign: 'center', }, });