Skip to content

Commit

Permalink
Prevent Share render if no url is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
ltatarev committed Sep 14, 2022
1 parent fcbc1ec commit 9af6d93
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions components/ShareButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ class ShareButton extends PureComponent {
onShare() {
const { title, message, url } = this.props;

if (!url) {
// eslint-disable-next-line no-console
console.warn('Share URL not specified.');
return null;
}

return Share.share({
title,
// URL property isn't supported on Android, so we are
Expand All @@ -40,7 +34,11 @@ class ShareButton extends PureComponent {
}

render() {
const { animationName, iconProps, ...otherProps } = this.props;
const { animationName, iconProps, url, ...otherProps } = this.props;

if (!url) {
return null;
}

return (
<Button onPress={this.onShare} {...otherProps}>
Expand Down

0 comments on commit 9af6d93

Please sign in to comment.