diff options
| author | Shravya Ramesh <37447613+shravyaramesh@users.noreply.github.com> | 2020-10-13 13:34:42 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-13 16:34:42 -0400 |
| commit | 22142e2f8aa7d5eed8de1e520fd5ce825d2c63ca (patch) | |
| tree | 46dd2646359fadd99dd41d8d3e67d11c8cade8a5 /src/components/profile/Moment.tsx | |
| parent | 2bd196c6165cbf45544dbc0a021daf5d313fde3c (diff) | |
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>
Diffstat (limited to 'src/components/profile/Moment.tsx')
| -rw-r--r-- | src/components/profile/Moment.tsx | 19 |
1 files changed, 16 insertions, 3 deletions
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<MomentProps> = ({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 ( <View style={styles.container}> |
