From 5fcffd40746b2074d523f53dc82c824d147444e5 Mon Sep 17 00:00:00 2001
From: Ivan Chen <ivan@tagg.id>
Date: Tue, 29 Jun 2021 16:29:06 -0400
Subject: Refactor buttons

---
 src/components/camera/SaveButton.tsx | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 src/components/camera/SaveButton.tsx

(limited to 'src/components/camera/SaveButton.tsx')

diff --git a/src/components/camera/SaveButton.tsx b/src/components/camera/SaveButton.tsx
new file mode 100644
index 00000000..840cc804
--- /dev/null
+++ b/src/components/camera/SaveButton.tsx
@@ -0,0 +1,26 @@
+import React from 'react';
+import {Text, TouchableOpacity} from 'react-native';
+import SaveIcon from '../../assets/icons/camera/save.svg';
+import {downloadImage} from '../../utils/camera';
+import {styles} from './styles';
+
+interface SaveButtonProps {
+  capturedImageURI: string;
+}
+
+/*
+ * Appears when a picture has been taken,
+ * On click, saves the captured image to "Recents" album on device gallery
+ */
+export const SaveButton: React.FC<SaveButtonProps> = ({capturedImageURI}) => (
+  <TouchableOpacity
+    onPress={() => {
+      downloadImage(capturedImageURI);
+    }}
+    style={styles.saveButton}>
+    <SaveIcon width={40} height={40} />
+    <Text style={styles.saveButtonLabel}>Save</Text>
+  </TouchableOpacity>
+);
+
+export default SaveButton;
-- 
cgit v1.2.3-70-g09d2

