diff options
author | Ivan Chen <ivan@tagg.id> | 2021-05-10 15:17:45 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-05-10 16:50:42 -0400 |
commit | 4f37038df45ee1aea6d42933ffa79f70a0a426d2 (patch) | |
tree | 063344d92d9d90b8f2b751bf64bedb73fe932e90 /src/components/common/LikeButton.tsx | |
parent | f9cee23e41c76bf6a5d607ba0d772b65aab7c3f0 (diff) |
added basic type, added like/unlike handler
Diffstat (limited to 'src/components/common/LikeButton.tsx')
-rw-r--r-- | src/components/common/LikeButton.tsx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/components/common/LikeButton.tsx b/src/components/common/LikeButton.tsx index 28eff768..f817bd98 100644 --- a/src/components/common/LikeButton.tsx +++ b/src/components/common/LikeButton.tsx @@ -4,10 +4,15 @@ import {normalize} from '../../utils'; interface LikeButtonProps { onPress: () => void; + filled: boolean; style: ImageStyle; } -const LikeButton: React.FC<LikeButtonProps> = ({onPress, style}) => { - const [filled, setFilled] = useState(false); +const LikeButton: React.FC<LikeButtonProps> = ({ + onPress, + filled: initialFillState, + style, +}) => { + const [filled, setFilled] = useState(initialFillState); const uri = filled ? require('../../assets/images/heart-filled.png') : require('../../assets/images/heart-outlined.png'); |