so I'm trying to pass a dynamically generated URL to Image
's source
prop and, due to React Native limitations, I cannot simply pass a variable as the value of that prop because it won't update to load the image after the variable is set.
So I'm trying to follow the advice here to trigger a change to the source
prop.
How can I set the value of a prop in useEffect?
Edit: this is what I'm trying, but still not successfully seeing the image
const [photoUrl, setPhotoUrl] = useState();
useEffect(() => {
async function getSetImg() {
let img = await getImage(job.afterPhoto.uri);
setPhotoUrl(img);
}
if (job) {
getSetImg;
}
}, [job]);
<Image
source={{ uri: photoUrl }}
style={styles.headerImage}
/>