From 75ca62c3c4575605cc45293a360a0cfb8a9396d9 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Wed, 25 Jan 2023 00:06:09 -0300 Subject: [PATCH] keep the same behavior for android and ios --- app/containers/message/Urls.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/containers/message/Urls.tsx b/app/containers/message/Urls.tsx index bfad394e8..ce67f47cd 100644 --- a/app/containers/message/Urls.tsx +++ b/app/containers/message/Urls.tsx @@ -1,5 +1,5 @@ import React, { useContext, useEffect, useState } from 'react'; -import { StyleSheet, Text, View } from 'react-native'; +import { Image, StyleSheet, Text, View } from 'react-native'; import Clipboard from '@react-native-clipboard/clipboard'; import FastImage from 'react-native-fast-image'; import { dequal } from 'dequal'; @@ -14,7 +14,7 @@ import EventEmitter from '../../lib/methods/helpers/events'; import I18n from '../../i18n'; import MessageContext from './Context'; import { IUrl } from '../../definitions'; -import { isImageURL } from '../../lib/methods/helpers'; +import { isIOS, isImageURL } from '../../lib/methods/helpers'; const styles = StyleSheet.create({ button: { @@ -108,8 +108,16 @@ const Url = React.memo( useEffect(() => { if (!url.image && url.url) { const testImageUrl = async () => { - const result = await isImageURL(url.url); - setIsImageUrlFromParamUrl(result); + if (isIOS) { + const result = await isImageURL(url.url); + setIsImageUrlFromParamUrl(result); + } else { + Image.getSize( + url.url, + () => setIsImageUrlFromParamUrl(true), + () => setIsImageUrlFromParamUrl(false) + ); + } }; testImageUrl(); }