aboutsummaryrefslogtreecommitdiff
path: root/src/components/camera
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-06-29 16:44:41 -0400
committerIvan Chen <ivan@tagg.id>2021-06-29 16:44:41 -0400
commit9d30c0c211e6b0b1b87e5de93a043e6e9f06beb3 (patch)
treecd4fb828626b91402deb674601e1013a181d91b3 /src/components/camera
parentf6fdd5d913c29855644f226d09d6cba60faf6e21 (diff)
Cleanup code, Fix gallery icon bug
Diffstat (limited to 'src/components/camera')
-rw-r--r--src/components/camera/GalleryIcon.tsx12
-rw-r--r--src/components/camera/styles.tsx20
2 files changed, 25 insertions, 7 deletions
diff --git a/src/components/camera/GalleryIcon.tsx b/src/components/camera/GalleryIcon.tsx
index ab226323..c49ace7d 100644
--- a/src/components/camera/GalleryIcon.tsx
+++ b/src/components/camera/GalleryIcon.tsx
@@ -1,6 +1,6 @@
import {useNavigation} from '@react-navigation/native';
import React from 'react';
-import {Image, Text, TouchableOpacity} from 'react-native';
+import {Image, Text, TouchableOpacity, View} from 'react-native';
import {ScreenType} from '../../types';
import {navigateToImagePicker} from '../../utils/camera';
import {styles} from './styles';
@@ -8,7 +8,7 @@ import {styles} from './styles';
interface GalleryIconProps {
screenType: ScreenType;
title: string;
- mostRecentPhoto: string;
+ mostRecentPhotoUri: string;
}
/*
@@ -18,20 +18,22 @@ interface GalleryIconProps {
export const GalleryIcon: React.FC<GalleryIconProps> = ({
screenType,
title,
- mostRecentPhoto,
+ mostRecentPhotoUri,
}) => {
const navigation = useNavigation();
return (
<TouchableOpacity
onPress={() => navigateToImagePicker(navigation, screenType, title)}
style={styles.saveButton}>
- {mostRecentPhoto !== '' && (
+ {mostRecentPhotoUri !== '' ? (
<Image
- source={{uri: mostRecentPhoto}}
+ source={{uri: mostRecentPhotoUri}}
width={40}
height={40}
style={styles.galleryIcon}
/>
+ ) : (
+ <View style={styles.galleryIconEmpty} />
)}
<Text style={styles.saveButtonLabel}>Gallery</Text>
</TouchableOpacity>
diff --git a/src/components/camera/styles.tsx b/src/components/camera/styles.tsx
index e810ffda..33b47cc4 100644
--- a/src/components/camera/styles.tsx
+++ b/src/components/camera/styles.tsx
@@ -32,6 +32,22 @@ export const styles = StyleSheet.create({
alignItems: 'center',
borderRadius: 30,
},
- galleryIcon: {borderWidth: 2, borderColor: 'white', borderRadius: 5},
- flashIcon: {zIndex: 2},
+ galleryIcon: {
+ borderWidth: 2,
+ borderColor: 'white',
+ borderRadius: 5,
+ width: 40,
+ height: 40,
+ },
+ galleryIconEmpty: {
+ borderWidth: 2,
+ borderColor: 'white',
+ borderRadius: 5,
+ width: 40,
+ height: 40,
+ backgroundColor: 'grey',
+ },
+ flashIcon: {
+ zIndex: 2,
+ },
});