From dffa6b5853f573126ac14a353ab2f3b01321b16c Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 16 Jul 2021 18:32:34 -0400 Subject: Add save button --- src/screens/upload/EditMedia.tsx | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/screens') diff --git a/src/screens/upload/EditMedia.tsx b/src/screens/upload/EditMedia.tsx index 0494375c..0f1062cf 100644 --- a/src/screens/upload/EditMedia.tsx +++ b/src/screens/upload/EditMedia.tsx @@ -7,13 +7,14 @@ import ImageZoom, {IOnMove} from 'react-native-image-pan-zoom'; import PhotoManipulator from 'react-native-photo-manipulator'; import TrimIcon from '../../assets/icons/trim.svg'; import CloseIcon from '../../assets/ionicons/close-outline.svg'; -import {TrimmerPlayer} from '../../components'; +import {SaveButton, TrimmerPlayer} from '../../components'; import {TaggLoadingIndicator, TaggSquareButton} from '../../components/common'; import {MainStackParams} from '../../routes'; import { cropVideo, HeaderHeight, normalize, + saveImageToGallery, SCREEN_HEIGHT, SCREEN_WIDTH, trimVideo, @@ -103,7 +104,7 @@ export const EditMedia: React.FC = ({route, navigation}) => { }, [origDimensions]); // Crops original image based of (x0, y0) and (x1, y1) coordinates - const handleNext = () => { + const processVideo = (callback: (finalUri: string) => void) => { if (checkIfUriImage(media.uri)) { if ( x0 !== undefined && @@ -154,14 +155,7 @@ export const EditMedia: React.FC = ({route, navigation}) => { trimmedURL, (croppedURL: string) => { setCropLoading(false); - navigation.navigate('CaptionScreen', { - screenType, - media: { - uri: croppedURL, - isVideo: true, - }, - selectedCategory, - }); + callback(croppedURL); }, videoCrop, ), @@ -362,8 +356,20 @@ export const EditMedia: React.FC = ({route, navigation}) => { )} + processVideo(saveImageToGallery)} /> + processVideo((uri) => + navigation.navigate('CaptionScreen', { + screenType, + media: { + uri: uri, + isVideo: true, + }, + selectedCategory, + }), + ) + } title={'Next'} buttonStyle={'normal'} buttonColor={'blue'} -- cgit v1.2.3-70-g09d2