From 9af6d931ece52ab7db86d40f417017d05780e8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucija=20Tatarevic=CC=81?= Date: Wed, 14 Sep 2022 11:34:38 +0200 Subject: [PATCH] Prevent Share render if no url is specified --- components/ShareButton.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/components/ShareButton.js b/components/ShareButton.js index 903b7b53..c49cbd70 100644 --- a/components/ShareButton.js +++ b/components/ShareButton.js @@ -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 @@ -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 (