diff options
author | Ivan Chen <ivan@tagg.id> | 2021-06-29 17:06:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-29 17:06:19 -0400 |
commit | 66c974161b59f1e3570e2a4a42334fabc16c2129 (patch) | |
tree | 7a1546101e2966b7bb38bf92bca4be64b1ccd7b6 /src/components/camera/GalleryIcon.tsx | |
parent | 53bdc94cf0491e348b7d4ad61e51ce1844423773 (diff) | |
parent | d4b210518eaffd3bf1320ca7ce7fa4a6d611528f (diff) |
Merge pull request #476 from shravyaramesh/tma937-tagg-camera
[TMA-937] Tagg Camera
Diffstat (limited to 'src/components/camera/GalleryIcon.tsx')
-rw-r--r-- | src/components/camera/GalleryIcon.tsx | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/components/camera/GalleryIcon.tsx b/src/components/camera/GalleryIcon.tsx new file mode 100644 index 00000000..c49ace7d --- /dev/null +++ b/src/components/camera/GalleryIcon.tsx @@ -0,0 +1,43 @@ +import {useNavigation} from '@react-navigation/native'; +import React from 'react'; +import {Image, Text, TouchableOpacity, View} from 'react-native'; +import {ScreenType} from '../../types'; +import {navigateToImagePicker} from '../../utils/camera'; +import {styles} from './styles'; + +interface GalleryIconProps { + screenType: ScreenType; + title: string; + mostRecentPhotoUri: string; +} + +/* + * Displays the most recent photo in the user's gallery + * On click, navigates to the image picker + */ +export const GalleryIcon: React.FC<GalleryIconProps> = ({ + screenType, + title, + mostRecentPhotoUri, +}) => { + const navigation = useNavigation(); + return ( + <TouchableOpacity + onPress={() => navigateToImagePicker(navigation, screenType, title)} + style={styles.saveButton}> + {mostRecentPhotoUri !== '' ? ( + <Image + source={{uri: mostRecentPhotoUri}} + width={40} + height={40} + style={styles.galleryIcon} + /> + ) : ( + <View style={styles.galleryIconEmpty} /> + )} + <Text style={styles.saveButtonLabel}>Gallery</Text> + </TouchableOpacity> + ); +}; + +export default GalleryIcon; |