After using my Expo React Native app and switching screens, all the images disappear. I then look at the logs and the blob data is displayed correctly. I think it might be a caching issue, but I have no idea why it would work at the start and then suddenly stop working. Please help.
Here is a code snippet:
const MenuItem = ({ item }) => {
const images = useImages();
const { name, id: catalogItemId, price } = item;
const imageUrl = images.get(catalogItemId);
const imageClassName = "w-full h-[120px] rounded-t-[10px]";
console.log(imageUrl+ `?timestamp=${Date.now()}`);
return (
<Pressable
onPress={() => router.push(`item/${catalogItemId}/-1`)}
className="flex-1 bg-white shadow-custom m-3 rounded-[10px]"
>
<Image
className={imageClassName}
source={{ uri: imageUrl + `?timestamp=${Date.now()}` }}
resizeMode="cover"
/>
<View className="w-full h-[90px] flex items-center px-3">
<Text className="font-koulen text-primary text-center text-[20px] leading-5 pt-4">{name}</Text>
<Text className="font-kokoro text-primary text-[14px]">${price.toFixed(2)}</Text>
</View>
</Pressable>
);
}
I thought the issue had to do with caching, but everything I have tried doesn’t seem to fix the issue.
Jacob Cohn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.