From 43e1c33edf6fca78e366403f167cc01ea075a226 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 7 May 2021 15:12:13 -0400 Subject: added like button --- src/components/common/LikeButton.tsx | 32 ++++++++++++++++++++++++++++++++ src/components/common/index.ts | 1 + 2 files changed, 33 insertions(+) create mode 100644 src/components/common/LikeButton.tsx (limited to 'src/components/common') 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 = ({onPress, style}) => { + const [filled, setFilled] = useState(false); + const uri = filled + ? require('../../assets/images/heart-filled.png') + : require('../../assets/images/heart-outlined.png'); + return ( + { + setFilled(!filled); + onPress(); + }}> + + + ); +}; + +const styles = StyleSheet.create({ + image: { + width: normalize(18), + height: normalize(15), + }, +}); + +export default LikeButton; diff --git a/src/components/common/index.ts b/src/components/common/index.ts index b38056c6..48abb8b8 100644 --- a/src/components/common/index.ts +++ b/src/components/common/index.ts @@ -26,3 +26,4 @@ export {default as BasicButton} from './BasicButton'; export {default as Avatar} from './Avatar'; export {default as TaggTypeahead} from './TaggTypeahead'; export {default as TaggUserRowCell} from './TaggUserRowCell'; +export {default as LikeButton} from './LikeButton'; -- cgit v1.2.3-70-g09d2