aboutsummaryrefslogtreecommitdiff
path: root/src/components/camera/GalleryIcon.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-07-01 16:52:19 -0400
committerGitHub <noreply@github.com>2021-07-01 16:52:19 -0400
commit202c94b6a5f96db228965a64a33e444511eea1cf (patch)
tree1d1ddbb28dd0276c7e4e0c7e6cb1de13245b2220 /src/components/camera/GalleryIcon.tsx
parentde390ea6b0f3bfd851029cf038aacd11f269a823 (diff)
parentc08a67f5cc1d622e91828d0557c6716a40ee5bad (diff)
Merge pull request #482 from IvanIFChen/tma953-camera-screen-merged-with-master
[TMA-953] Camera Screen from Master to PoC Video Branch
Diffstat (limited to 'src/components/camera/GalleryIcon.tsx')
-rw-r--r--src/components/camera/GalleryIcon.tsx39
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..8d396550
--- /dev/null
+++ b/src/components/camera/GalleryIcon.tsx
@@ -0,0 +1,39 @@
+import React from 'react';
+import {Image, Text, TouchableOpacity, View} from 'react-native';
+import {navigateToImagePicker} from '../../utils/camera';
+import {Image as ImageType} from 'react-native-image-crop-picker';
+import {styles} from './styles';
+
+interface GalleryIconProps {
+ mostRecentPhotoUri: string;
+ callback: (pic: ImageType) => void;
+}
+
+/*
+ * Displays the most recent photo in the user's gallery
+ * On click, navigates to the image picker
+ */
+export const GalleryIcon: React.FC<GalleryIconProps> = ({
+ mostRecentPhotoUri,
+ callback,
+}) => {
+ return (
+ <TouchableOpacity
+ onPress={() => navigateToImagePicker(callback)}
+ 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;