diff options
author | Ivan Chen <ivan@tagg.id> | 2021-06-30 15:47:24 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-06-30 15:47:24 -0400 |
commit | 56ec3a62ebbade90f3d0fb3ff2ccbcbfc091672b (patch) | |
tree | 6533eb5db111e0675ca3e38390678036254d35ab | |
parent | 159ae12d6679441d16791bbf23d05240e3779101 (diff) |
Cleanup code
-rw-r--r-- | src/components/moments/Moment.tsx | 5 | ||||
-rw-r--r-- | src/screens/moments/CameraScreen.tsx | 32 |
2 files changed, 18 insertions, 19 deletions
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<MomentProps> = ({ }) => { 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<MomentProps> = ({ <PlusIcon width={23} height={23} - onPress={() => navigateToCameraScreen()} + onPress={navigateToCameraScreen} color={TAGG_LIGHT_BLUE} style={styles.horizontalMargin} /> @@ -158,7 +159,7 @@ const Moment: React.FC<MomentProps> = ({ /> ))} {(images === undefined || images.length === 0) && !userXId && ( - <TouchableOpacity onPress={() => navigateToCameraScreen()}> + <TouchableOpacity onPress={navigateToCameraScreen}> <LinearGradient colors={['rgba(105, 141, 211, 1)', 'rgba(105, 141, 211, 0.3)']}> <View style={styles.defaultImage}> 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<CameraScreenProps> = ({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<CameraScreenProps> = ({route, navigation}) => { <View style={styles.bottomRightContainer}> {capturedImage ? ( <TaggSquareButton - onPress={handleNext} + onPress={navigateToCaptionScreen} title={'Next'} buttonStyle={'large'} buttonColor={'blue'} @@ -139,16 +146,7 @@ const CameraScreen: React.FC<CameraScreenProps> = ({route, navigation}) => { mostRecentPhotoUri={mostRecentPhoto} callback={() => navigateToImagePicker((pic) => { - if (pic.filename) { - navigation.navigate('ZoomInCropper', { - screenType, - title, - media: { - uri: pic.path, - isVideo: false, - }, - }); - } + navigateToCropper(pic.path); }) } /> |