diff options
author | Ivan Chen <ivan@tagg.id> | 2021-06-29 16:29:06 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-06-29 16:29:06 -0400 |
commit | 5fcffd40746b2074d523f53dc82c824d147444e5 (patch) | |
tree | 5bbb93a56454778996a543a567cc0d8d9d60d11e /src/components/camera/GalleryIcon.tsx | |
parent | f273a7aa1c2e27692c2a03ae1e2fc9b81360558d (diff) |
Refactor buttons
Diffstat (limited to 'src/components/camera/GalleryIcon.tsx')
-rw-r--r-- | src/components/camera/GalleryIcon.tsx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/components/camera/GalleryIcon.tsx b/src/components/camera/GalleryIcon.tsx new file mode 100644 index 00000000..19a63a9a --- /dev/null +++ b/src/components/camera/GalleryIcon.tsx @@ -0,0 +1,39 @@ +import {useNavigation} from '@react-navigation/native'; +import React from 'react'; +import {Image, Text, TouchableOpacity} from 'react-native'; +import {ScreenType} from '../../types'; +import {navigateToImagePicker} from '../../utils/camera'; +import {styles} from './styles'; + +interface GalleryIconProps { + screenType: ScreenType; + title: string; + mostRecentPhoto: 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, + mostRecentPhoto, +}) => { + const navigation = useNavigation(); + return ( + <TouchableOpacity + onPress={() => navigateToImagePicker(navigation, screenType, title)} + style={styles.saveButton}> + <Image + source={{uri: mostRecentPhoto}} + width={40} + height={40} + style={styles.galleryIcon} + /> + <Text style={styles.saveButtonLabel}>Gallery</Text> + </TouchableOpacity> + ); +}; + +export default GalleryIcon; |