title: <Image> view the old picture even after capturing a new picture using react-native-vision-camera
body: <p>I'm using <code>react-native-vision-camera</code> to capture a picture and view it inside an <code>&lt;Image&gt;</code> component. The expected behavior is updating the picture after capturing a new one. Since the <code>source</code> property of the <code>&lt;Image&gt;</code> component points to a new picture (with the same name Ok, but still, it's a new picture).</p>
  <p>But this never happens. Even when I reload the app, <code>&lt;Image&gt;</code> still shows the old picture. I have to rename the new picture.</p>
  <p>I thought that this happens because maybe the state of the <code>source</code> property updates before <code>react-native-vision-camera</code> saves the new picture so the <code>&lt;Image&gt;</code> component renders the old picture but I'm using <code>async-await</code> so as far as I know, this shouldn't happen.</p>
  <p>The code I wrote for the capturing function is</p>
  <pre><code>const [photoPath, setPhotoPath] = useState(&quot;&quot;);
  
  const capture = async () =&gt; {
          const photo = await camera.current.takePhoto();
          const path = RNFS.ExternalDirectoryPath + '/photo-X.jpg';
          //when i update X (in the saved image name) with a new number,
          //&lt;Image&gt; views the correct image.
  
          await RNFS.moveFile(photo.path, path)
          setPhotoPath(&quot;file://&quot; + path)
      }
  </code></pre>
  <p>the code to view the image</p>
  <pre><code>{
      photoPath.length &gt; 0 ?
          &lt; Image
            source={{ uri: photoPath }}
            style={[styles.camera, { backgroundColor: 'black' }]}
          /&gt;
      :
          null
  }
  </code></pre>
  <p>I have a capture <code>&lt;Button&gt;</code> that calls the <code>capture()</code> function that updates the <code>photoPath</code> state that should update the <code>source</code> of the <code>&lt;Image&gt;</code> component and this process should view the new picture. But this never happens even after reloading the app. I have to pick a new name for the new picture to get it to be viewed. Why I'm getting this behavior instead of the one I'm expecting? What's wrong with my code, or my understanding, and what is the correct solution?</p>