Props:
String title: Title to be sharedString link : Link to be sharedint id: reference id, used in ReadingListButton.Global Variables:
none.
Local Variables:
none.
Purpose:
This component renders two buttons (facebook and twitter). It uses ShareButton to construct the buttons. It takes three props to construct links to social media and constructs a button to that respective link.
Source Code:
const SocialMediaButton = ({ title, link, id }) => {
let twitterLink = `https://twitter.com/intent/tweet?`;
twitterLink += `text=${title}`;
twitterLink += `&url=${link}`;
return (
<View style={styles.socialMediaDiv}>
<TouchableOpacity style={styles.socialMediaButton} onPress={() => Linking.openURL(twitterLink)}>
<Image
style={{
width: '100%',
height: '100%',
resizeMode: 'contain',
}}
source={twitterLogo}
/>
</TouchableOpacity>
<ReadingListButton id={id} />
<ShareButton title={title} link={link} />
</View>
);
};