<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: yar Coder</title>
    <description>The latest articles on DEV Community by yar Coder (@yarcoder).</description>
    <link>https://dev.to/yarcoder</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F7843%2F363d73a1-9c5b-4150-aa50-6144a0cc1b10.jpg</url>
      <title>DEV Community: yar Coder</title>
      <link>https://dev.to/yarcoder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yarcoder"/>
    <language>en</language>
    <item>
      <title>Make Image Loading (React Native)</title>
      <dc:creator>Zain Ahmed</dc:creator>
      <pubDate>Fri, 09 Oct 2020 06:27:21 +0000</pubDate>
      <link>https://dev.to/yarcoder/make-image-loading-react-native-2k37</link>
      <guid>https://dev.to/yarcoder/make-image-loading-react-native-2k37</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbkjjbp2gvki201eqz4cj.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbkjjbp2gvki201eqz4cj.gif" alt="Alt Text" width="320" height="640"&gt;&lt;/a&gt;&lt;br&gt;
Suppose we have array of 10 Objects and every object has a url of image which are multi mb’s like 50mb, 45mb etc, so it take time to display image on screen bcz to fetch image from url it take time’s , here is the solution while image is downloading we can show any default image or loader for every image in loop , let start!&lt;br&gt;
here is our array&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd0zxm8r93idu9u0aownl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd0zxm8r93idu9u0aownl.png" alt="Alt Text" width="800" height="296"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwn1vkda9u1rvr7jnx4gd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwn1vkda9u1rvr7jnx4gd.png" alt="Alt Text" width="800" height="239"&gt;&lt;/a&gt;&lt;br&gt;
here is my main component for render the array with flatlist ,&lt;br&gt;
inside flat list i create a component name ImageItem,&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm9ost362kprdezu6e2p1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm9ost362kprdezu6e2p1.png" alt="Alt Text" width="800" height="445"&gt;&lt;/a&gt;&lt;br&gt;
i declare loading State for show load or default image , while fetching image&lt;br&gt;
in render method i just made a condition that if loading is true i am showing loader and if loading is false i ll show image&lt;br&gt;
the Image tag have 2 props which will use for this main part , onLoadStart which execute when image fetching start and i update the state loading true,&lt;br&gt;
onLoadEnd will execute when image fetching is complete and ready to display so i update loading false , its that simple,&lt;/p&gt;

&lt;p&gt;hope you learn from it , support me on my YouTube channel &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
