From 58ab56d0b03491dd062d09e2ee96fe8f88e74bc9 Mon Sep 17 00:00:00 2001
From: Ivan Chen <ivan@tagg.id>
Date: Tue, 11 May 2021 17:55:43 -0400
Subject: fixed issue, basic functionality working

---
 src/components/common/LikeButton.tsx | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

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

diff --git a/src/components/common/LikeButton.tsx b/src/components/common/LikeButton.tsx
index f817bd98..43b3ac37 100644
--- a/src/components/common/LikeButton.tsx
+++ b/src/components/common/LikeButton.tsx
@@ -4,23 +4,25 @@ import {normalize} from '../../utils';
 
 interface LikeButtonProps {
   onPress: () => void;
-  filled: boolean;
   style: ImageStyle;
+  initialLikeState: boolean;
 }
 const LikeButton: React.FC<LikeButtonProps> = ({
   onPress,
-  filled: initialFillState,
   style,
+  initialLikeState,
 }) => {
-  const [filled, setFilled] = useState(initialFillState);
+  const [filled, setFilled] = useState(initialLikeState);
   const uri = filled
     ? require('../../assets/images/heart-filled.png')
     : require('../../assets/images/heart-outlined.png');
   return (
     <TouchableOpacity
       onPress={() => {
-        setFilled(!filled);
-        onPress();
+        if (filled === initialLikeState) {
+          setFilled(!filled);
+          onPress();
+        }
       }}>
       <Image style={[styles.image, style]} source={uri} />
     </TouchableOpacity>
-- 
cgit v1.2.3-70-g09d2

