Viktoriia 1 месяц назад
Родитель
Сommit
eb65d5a205

+ 10 - 5
src/screens/InAppScreens/MessagesScreen/Components/RenderMessageImage.tsx

@@ -86,12 +86,17 @@ const RenderMessageImage = ({
           uri: isCached ? fileUri : currentMessage.image,
           headers: { Nmtoken: token, 'App-Version': APP_VERSION, Platform: Platform.OS }
         }}
-        loadingIndicatorSource={{ uri: currentMessage.image }}
+        loadingIndicatorSource={{ uri: isCached ? fileUri : currentMessage.image }}
         style={styles.chatImage}
         resizeMode="cover"
-        onLoadStart={() => setImageLoading(true)}
+        onLoadStart={() => {
+          if (isCached) return;
+          setImageLoading(true);
+        }}
         onLoad={() => {
-          setImageLoading(false);
+          setTimeout(() => {
+            setImageLoading(false);
+          }, 100);
           setRetryCount(0);
         }}
         onLoadEnd={() => setImageLoading(false)}
@@ -105,7 +110,7 @@ const RenderMessageImage = ({
         }}
       />
 
-      {(currentMessage.isSending || imageLoading) && (
+      {currentMessage.isSending || imageLoading ? (
         <View
           style={{
             position: 'absolute',
@@ -122,7 +127,7 @@ const RenderMessageImage = ({
             color={leftMessage ? Colors.DARK_BLUE : Colors.FILL_LIGHT}
           />
         </View>
-      )}
+      ) : null}
     </TouchableOpacity>
   );
 };