fix the MessageURl showing when there isn't hasContent or imageUrl

This commit is contained in:
Reinaldo Neto 2023-01-11 17:07:43 -03:00
parent ae0a218a7a
commit 2c1a412fce
1 changed files with 25 additions and 21 deletions

View File

@ -124,27 +124,31 @@ const Url = React.memo(
const hasContent = !!url.title || !!url.description;
return (
<Touchable
onPress={onPress}
onLongPress={onLongPress}
style={[
styles.button,
index > 0 && styles.marginTop,
styles.container,
{
backgroundColor: themes[theme].chatComponentBackground,
borderColor: themes[theme].borderColor
}
]}
background={Touchable.Ripple(themes[theme].bannerBackground)}
>
<>
<UrlImage image={imageUrl} hasContent={hasContent} />
{hasContent ? <UrlContent title={url.title} description={url.description} theme={theme} /> : null}
</>
</Touchable>
);
if (hasContent || imageUrl) {
return (
<Touchable
onPress={onPress}
onLongPress={onLongPress}
style={[
styles.button,
index > 0 && styles.marginTop,
styles.container,
{
backgroundColor: themes[theme].chatComponentBackground,
borderColor: themes[theme].borderColor
}
]}
background={Touchable.Ripple(themes[theme].bannerBackground)}
>
<>
<UrlImage image={imageUrl} hasContent={hasContent} />
{hasContent ? <UrlContent title={url.title} description={url.description} theme={theme} /> : null}
</>
</Touchable>
);
}
return null;
},
(oldProps, newProps) => dequal(oldProps.url, newProps.url) && oldProps.theme === newProps.theme
);