From 56ec3a62ebbade90f3d0fb3ff2ccbcbfc091672b Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Wed, 30 Jun 2021 15:47:24 -0400 Subject: Cleanup code --- src/components/moments/Moment.tsx | 5 +++-- src/screens/moments/CameraScreen.tsx | 32 +++++++++++++++----------------- 2 files changed, 18 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index 50c60fd9..108ea100 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -43,6 +43,7 @@ const Moment: React.FC = ({ }) => { const navigation = useNavigation(); + // TODO: remove this later, tmp solution for handling videos const navigateToCaptionScreenForVideo = (uri: string) => { navigation.navigate('CaptionScreen', { screenType, @@ -128,7 +129,7 @@ const Moment: React.FC = ({ navigateToCameraScreen()} + onPress={navigateToCameraScreen} color={TAGG_LIGHT_BLUE} style={styles.horizontalMargin} /> @@ -158,7 +159,7 @@ const Moment: React.FC = ({ /> ))} {(images === undefined || images.length === 0) && !userXId && ( - navigateToCameraScreen()}> + diff --git a/src/screens/moments/CameraScreen.tsx b/src/screens/moments/CameraScreen.tsx index 104774c0..7b71f9e5 100644 --- a/src/screens/moments/CameraScreen.tsx +++ b/src/screens/moments/CameraScreen.tsx @@ -66,17 +66,24 @@ const CameraScreen: React.FC = ({route, navigation}) => { ); }, [capturedImage]); - console.log(capturedImage); - /* - * Appears once a picture has been captured to navigate to the caption screen - */ - const handleNext = () => { + const navigateToCropper = (uri: string) => { + navigation.navigate('ZoomInCropper', { + screenType, + title, + media: { + uri, + isVideo: false, // TODO: only support image for now + }, + }); + }; + + const navigateToCaptionScreen = () => { navigation.navigate('CaptionScreen', { screenType, title, media: { uri: capturedImage, - isVideo: false, // TODO: false for now + isVideo: false, // TODO: only support image for now }, }); }; @@ -126,7 +133,7 @@ const CameraScreen: React.FC = ({route, navigation}) => { {capturedImage ? ( = ({route, navigation}) => { mostRecentPhotoUri={mostRecentPhoto} callback={() => navigateToImagePicker((pic) => { - if (pic.filename) { - navigation.navigate('ZoomInCropper', { - screenType, - title, - media: { - uri: pic.path, - isVideo: false, - }, - }); - } + navigateToCropper(pic.path); }) } /> -- cgit v1.2.3-70-g09d2