From 43e1c33edf6fca78e366403f167cc01ea075a226 Mon Sep 17 00:00:00 2001
From: Ivan Chen <ivan@tagg.id>
Date: Fri, 7 May 2021 15:12:13 -0400
Subject: added like button

---
 src/components/common/LikeButton.tsx | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 src/components/common/LikeButton.tsx

(limited to 'src/components/common/LikeButton.tsx')

diff --git a/src/components/common/LikeButton.tsx b/src/components/common/LikeButton.tsx
new file mode 100644
index 00000000..28eff768
--- /dev/null
+++ b/src/components/common/LikeButton.tsx
@@ -0,0 +1,32 @@
+import React, {useState} from 'react';
+import {Image, ImageStyle, StyleSheet, TouchableOpacity} from 'react-native';
+import {normalize} from '../../utils';
+
+interface LikeButtonProps {
+  onPress: () => void;
+  style: ImageStyle;
+}
+const LikeButton: React.FC<LikeButtonProps> = ({onPress, style}) => {
+  const [filled, setFilled] = useState(false);
+  const uri = filled
+    ? require('../../assets/images/heart-filled.png')
+    : require('../../assets/images/heart-outlined.png');
+  return (
+    <TouchableOpacity
+      onPress={() => {
+        setFilled(!filled);
+        onPress();
+      }}>
+      <Image style={[styles.image, style]} source={uri} />
+    </TouchableOpacity>
+  );
+};
+
+const styles = StyleSheet.create({
+  image: {
+    width: normalize(18),
+    height: normalize(15),
+  },
+});
+
+export default LikeButton;
-- 
cgit v1.2.3-70-g09d2

