From cce1f4ad7f3331ef5c111423fe46fc1d59c7638d Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 16 Jul 2021 18:51:34 -0400 Subject: Clean up styles, Fix save to gallery --- src/screens/upload/EditMedia.tsx | 61 ++++++++++++++++++++++------------------ src/utils/camera.ts | 7 +++-- 2 files changed, 39 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/screens/upload/EditMedia.tsx b/src/screens/upload/EditMedia.tsx index 1d42e675..e53e2e43 100644 --- a/src/screens/upload/EditMedia.tsx +++ b/src/screens/upload/EditMedia.tsx @@ -339,32 +339,38 @@ export const EditMedia: React.FC = ({route, navigation}) => { )} - - processVideo(saveImageToGallery)} - /> - - processVideo((uri) => - navigation.navigate('CaptionScreen', { - screenType, - media: { - uri: uri, - isVideo: media.isVideo, - }, - selectedCategory, - }), - ) - } - title={'Next'} - buttonStyle={'large'} - buttonColor={'blue'} - labelColor={'white'} - labelStyle={styles.buttonLabel} - /> - + {hideTrimmer && ( + + + processVideo((uri) => + saveImageToGallery(uri, media.isVideo ? 'video' : 'photo'), + ) + } + /> + + processVideo((uri) => + navigation.navigate('CaptionScreen', { + screenType, + media: { + uri: uri, + isVideo: media.isVideo, + }, + selectedCategory, + }), + ) + } + title={'Next'} + buttonStyle={'large'} + buttonColor={'blue'} + labelColor={'white'} + labelStyle={styles.buttonLabel} + /> + + )} ); }; @@ -383,9 +389,10 @@ const styles = StyleSheet.create({ marginLeft: '5%', }, bottomContainer: { + position: 'absolute', + bottom: SCREEN_HEIGHT * 0.1, width: SCREEN_WIDTH * 0.8, justifyContent: 'space-between', - marginBottom: SCREEN_HEIGHT * 0.1, alignItems: 'center', alignSelf: 'center', flexDirection: 'row', diff --git a/src/utils/camera.ts b/src/utils/camera.ts index 5485b1ca..9d7ff67f 100644 --- a/src/utils/camera.ts +++ b/src/utils/camera.ts @@ -48,8 +48,11 @@ export const takeVideo = ( } }; -export const saveImageToGallery = (capturedImageURI: string) => { - CameraRoll.save(capturedImageURI, {album: 'Recents', type: 'photo'}) +export const saveImageToGallery = ( + capturedImageURI: string, + type: 'photo' | 'video', +) => { + CameraRoll.save(capturedImageURI, {album: 'Recents', type: type}) .then((_res) => Alert.alert('Saved to device!')) .catch((_err) => Alert.alert('Failed to save to device!')); }; -- cgit v1.2.3-70-g09d2