From f3134bbe9b8bc84a906ca1dac46959b360dd243f Mon Sep 17 00:00:00 2001 From: Shravya Ramesh Date: Wed, 16 Jun 2021 01:58:59 -0700 Subject: image cropper dump --- src/components/comments/ImageCropper.tsx | 94 ++++++++++++++++++++++++++++++++ src/components/comments/index.ts | 1 + src/components/moments/Moment.tsx | 10 +--- src/routes/main/MainStackNavigator.tsx | 10 +++- src/routes/main/MainStackScreen.tsx | 8 +++ src/screens/profile/CaptionScreen.tsx | 2 +- 6 files changed, 116 insertions(+), 9 deletions(-) create mode 100644 src/components/comments/ImageCropper.tsx (limited to 'src') diff --git a/src/components/comments/ImageCropper.tsx b/src/components/comments/ImageCropper.tsx new file mode 100644 index 00000000..7d4eabff --- /dev/null +++ b/src/components/comments/ImageCropper.tsx @@ -0,0 +1,94 @@ +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 ( + <> + + +