aboutsummaryrefslogtreecommitdiff
path: root/src/components/camera/FlipButton.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-06-29 17:06:19 -0400
committerGitHub <noreply@github.com>2021-06-29 17:06:19 -0400
commit66c974161b59f1e3570e2a4a42334fabc16c2129 (patch)
tree7a1546101e2966b7bb38bf92bca4be64b1ccd7b6 /src/components/camera/FlipButton.tsx
parent53bdc94cf0491e348b7d4ad61e51ce1844423773 (diff)
parentd4b210518eaffd3bf1320ca7ce7fa4a6d611528f (diff)
Merge pull request #476 from shravyaramesh/tma937-tagg-camera
[TMA-937] Tagg Camera
Diffstat (limited to 'src/components/camera/FlipButton.tsx')
-rw-r--r--src/components/camera/FlipButton.tsx29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/components/camera/FlipButton.tsx b/src/components/camera/FlipButton.tsx
new file mode 100644
index 00000000..c6f710a9
--- /dev/null
+++ b/src/components/camera/FlipButton.tsx
@@ -0,0 +1,29 @@
+import React, {Dispatch, SetStateAction} from 'react';
+import {Text, TouchableOpacity} from 'react-native';
+import {CameraType} from 'react-native-camera';
+import FlipIcon from '../../assets/icons/camera/flip.svg';
+import {styles} from './styles';
+
+interface FlipButtonProps {
+ setCameraType: Dispatch<SetStateAction<keyof CameraType>>;
+ cameraType: keyof CameraType;
+}
+
+/*
+ * Toggles between back camera and front camera
+ * Appears only when user has not taken a picture yet
+ * Once user takes a picture, this button disappears to reveal the save button
+ */
+export const FlipButton: React.FC<FlipButtonProps> = ({
+ setCameraType,
+ cameraType,
+}) => (
+ <TouchableOpacity
+ onPress={() => setCameraType(cameraType === 'front' ? 'back' : 'front')}
+ style={styles.saveButton}>
+ <FlipIcon width={40} height={40} />
+ <Text style={styles.saveButtonLabel}>Flip</Text>
+ </TouchableOpacity>
+);
+
+export default FlipButton;