aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/LikeButton.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/common/LikeButton.tsx')
-rw-r--r--src/components/common/LikeButton.tsx32
1 files changed, 32 insertions, 0 deletions
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;