From 251223a0c9c382e2d06d61432e9732dba83e4f86 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Tue, 7 Mar 2023 11:15:17 -0300 Subject: [PATCH] remove react memo from urlImage --- app/containers/message/Urls.tsx | 63 +++++++++++++++------------------ 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/app/containers/message/Urls.tsx b/app/containers/message/Urls.tsx index 8a0806af1..b8c623239 100644 --- a/app/containers/message/Urls.tsx +++ b/app/containers/message/Urls.tsx @@ -52,50 +52,43 @@ const styles = StyleSheet.create({ imageWithoutContent: { borderRadius: 4 }, - activityPosition: { - zIndex: 2, - position: 'absolute' - }, loading: { height: 0, borderWidth: 0 } }); -const UrlImage = React.memo( - ({ - image, - setImageLoadedState, - hasContent, - imageLoadedState - }: { - image: string; - setImageLoadedState(value: TImageLoadedState): void; - hasContent: boolean; - imageLoadedState: TImageLoadedState; - }) => { - const { baseUrl, user } = useContext(MessageContext); +const UrlImage = ({ + image, + setImageLoadedState, + hasContent, + imageLoadedState +}: { + image: string; + setImageLoadedState(value: TImageLoadedState): void; + hasContent: boolean; + imageLoadedState: TImageLoadedState; +}) => { + const { baseUrl, user } = useContext(MessageContext); - if (!image) { - return null; - } + if (!image) { + return null; + } - image = image.includes('http') ? image : `${baseUrl}/${image}?rc_uid=${user.id}&rc_token=${user.token}`; + image = image.includes('http') ? image : `${baseUrl}/${image}?rc_uid=${user.id}&rc_token=${user.token}`; - return ( - <> - setImageLoadedState('error')} - onLoad={() => setImageLoadedState('done')} - /> - - ); - }, - (prevProps, nextProps) => prevProps.image === nextProps.image && prevProps.imageLoadedState === nextProps.imageLoadedState -); + return ( + <> + setImageLoadedState('error')} + onLoad={() => setImageLoadedState('done')} + /> + + ); +}; const UrlContent = React.memo( ({ title, description, theme }: { title: string; description: string; theme: TSupportedThemes }) => (