aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/comments/ZoomInCropper.tsx105
-rw-r--r--src/components/moments/Moment.tsx4
-rw-r--r--src/routes/main/MainStackNavigator.tsx4
3 files changed, 95 insertions, 18 deletions
diff --git a/src/components/comments/ZoomInCropper.tsx b/src/components/comments/ZoomInCropper.tsx
index 1620d777..4e8f9e7c 100644
--- a/src/components/comments/ZoomInCropper.tsx
+++ b/src/components/comments/ZoomInCropper.tsx
@@ -1,30 +1,103 @@
import {RouteProp} from '@react-navigation/core';
import {StackNavigationProp} from '@react-navigation/stack';
-import React from 'react';
-import {Image, Dimensions, Text} from 'react-native';
+import React, {useEffect, useState} from 'react';
+import {Dimensions, Image, StyleSheet, TouchableOpacity} from 'react-native';
+import {normalize} from 'react-native-elements';
import ImageZoom from 'react-native-image-pan-zoom';
-import {SCREEN_WIDTH} from '../../utils';
+import CloseIcon from '../../assets/ionicons/close-outline.svg';
import {MainStackParams} from '../../routes';
+import {HeaderHeight, SCREEN_WIDTH} from '../../utils';
+import {TaggSquareButton} from '../common';
type ZoomInCropperRouteProps = RouteProp<MainStackParams, 'ZoomInCropper'>;
-
+type ZoomInCropperNavigationProps = StackNavigationProp<
+ MainStackParams,
+ 'ZoomInCropper'
+>;
interface ZoomInCropperProps {
route: ZoomInCropperRouteProps;
+ navigation: ZoomInCropperNavigationProps;
}
-export const ZoomInCropper: React.FC<ZoomInCropperProps> = ({route}) => {
+export const ZoomInCropper: React.FC<ZoomInCropperProps> = ({
+ route,
+ navigation,
+}) => {
+ const {screenType, title, image} = route.params;
+ const [aspectRatio, setAspectRatio] = useState<number>(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 (
- <ImageZoom
- cropWidth={Dimensions.get('window').width}
- cropHeight={Dimensions.get('window').height}
- imageWidth={200}
- imageHeight={200}>
- <Image
- style={{width: 200, height: 200}}
- source={{
- uri: route.params.imageURI,
- }}
+ <>
+ <TouchableOpacity
+ style={styles.closeButton}
+ onPress={() => navigation.goBack()}>
+ <CloseIcon height={25} width={25} color={'white'} />
+ </TouchableOpacity>
+ <ImageZoom
+ style={{backgroundColor: 'black'}}
+ cropWidth={Dimensions.get('window').width}
+ cropHeight={Dimensions.get('window').height}
+ imageWidth={SCREEN_WIDTH}
+ imageHeight={SCREEN_WIDTH / aspectRatio}>
+ <Image
+ style={{width: SCREEN_WIDTH, height: SCREEN_WIDTH / aspectRatio}}
+ source={{
+ uri: image.sourceURL,
+ }}
+ />
+ </ImageZoom>
+ <TaggSquareButton
+ onPress={() => console.log('Navigate to caption screen')}
+ title={'Next'}
+ buttonStyle={'normal'}
+ buttonColor={'blue'}
+ labelColor={'white'}
+ style={styles.button}
+ labelStyle={styles.buttonLabel}
/>
- </ImageZoom>
+ </>
);
};
+
+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',
+ },
+});
diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx
index 557f9d4a..1d4509dd 100644
--- a/src/components/moments/Moment.tsx
+++ b/src/components/moments/Moment.tsx
@@ -62,7 +62,9 @@ const Moment: React.FC<MomentProps> = ({
// image: picture,
// });
navigation.navigate('ZoomInCropper', {
- imageURI: picture.path,
+ screenType,
+ title: title,
+ image: picture,
});
}
})
diff --git a/src/routes/main/MainStackNavigator.tsx b/src/routes/main/MainStackNavigator.tsx
index bee5b54b..2c1ded98 100644
--- a/src/routes/main/MainStackNavigator.tsx
+++ b/src/routes/main/MainStackNavigator.tsx
@@ -116,7 +116,9 @@ export type MainStackParams = {
title: string;
};
ZoomInCropper: {
- imageURI: string;
+ image: Image;
+ screenType: ScreenType;
+ title: string;
};
};