From 22142e2f8aa7d5eed8de1e520fd5ce825d2c63ca Mon Sep 17 00:00:00 2001 From: Shravya Ramesh <37447613+shravyaramesh@users.noreply.github.com> Date: Tue, 13 Oct 2020 13:34:42 -0700 Subject: TMA - 232 Create caption screen with image picker (#53) * Added image picture functionality * Created caption screen and uploads to moments endpoint consisting of the picture and caption only Co-authored-by: Husam Salhab <47015061+hsalhab@users.noreply.github.com> --- src/components/profile/Moment.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/components/profile/Moment.tsx') diff --git a/src/components/profile/Moment.tsx b/src/components/profile/Moment.tsx index 0fbabe8f..6ae8d38e 100644 --- a/src/components/profile/Moment.tsx +++ b/src/components/profile/Moment.tsx @@ -1,6 +1,6 @@ import {useNavigation} from '@react-navigation/native'; import React from 'react'; -import {Alert, StyleSheet, View} from 'react-native'; +import {StyleSheet, View} from 'react-native'; import {Text} from 'react-native-animatable'; import {ScrollView, TouchableOpacity} from 'react-native-gesture-handler'; import LinearGradient from 'react-native-linear-gradient'; @@ -8,6 +8,7 @@ import PlusIcon from '../../assets/icons/plus_icon-01.svg'; import BigPlusIcon from '../../assets/icons/plus_icon-02.svg'; import {MOMENTS_TITLE_COLOR} from '../../constants'; import {SCREEN_WIDTH} from '../../utils'; +import ImagePicker from 'react-native-image-crop-picker'; interface MomentProps { title: string; @@ -16,9 +17,21 @@ interface MomentProps { const Moment: React.FC = ({title, images}) => { const navigation = useNavigation(); + const navigateToImagePicker = () => { - Alert.alert('Perform navigation to Image Picker with Caption screen'); - // navigation.navigate('') + ImagePicker.openPicker({ + width: 580, + height: 580, + cropping: true, + cropperToolbarTitle: 'Upload a moment', + mediaType: 'photo', + }) + .then((picture) => { + if ('path' in picture) { + navigation.navigate('CaptionScreen', {title: title, image: picture}); + } + }) + .catch(() => {}); }; return ( -- cgit v1.2.3-70-g09d2