import {RouteProp} from '@react-navigation/core'; import {useFocusEffect} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; import React, {useCallback, useRef, useState} from 'react'; import {Button, StatusBar, View} from 'react-native'; import {CropView} from 'react-native-image-crop-tools'; import {MainStackParams} from '../../routes'; import {HeaderHeight} from '../../utils'; type ImageCropperRouteProps = RouteProp; type ImageCropperNavigationProps = StackNavigationProp< MainStackParams, 'ImageCropper' >; interface ImageCropperProps { route: ImageCropperRouteProps; navigation: ImageCropperNavigationProps; } const ImageCropper: React.FC = ({route, navigation}) => { const {image, title, screenType} = route.params; const cropViewRef = useRef(); const aspectRatios = [ {width: 9, height: 16}, {width: 4, height: 5}, {width: 1, height: 1}, ]; const [aspectRatioIndex, setAspectRatioIndex] = useState(0); //Function to get the parent TabBar navigator and setting the option for this screen. useFocusEffect( useCallback(() => { navigation.dangerouslyGetParent()?.setOptions({ tabBarVisible: false, }); return () => { navigation.dangerouslyGetParent()?.setOptions({ tabBarVisible: true, }); }; }, [navigation]), ); return ( <>