Harika
Harika

Reputation: 1131

Image is disappearing with same uri

I am running sample application. I am using amazon s3 to store the profile pics. So, I have to use the same url for the profile pictures. I give the Image a unique key prop to try and get it to reload the image, but it displays a previously uploaded image. It means cache is not cleared for image component.

I tried this below code. Image should be updated perfectly but any changes doing in that screen then image will be disappearing.

This issue only appears in android.

 <Image
    source={{uri: this.state.uri + '?' + new Date()}}
    />

Please refer this link:- enter link description here

Screenshot:-

enter image description here

Upvotes: 4

Views: 279

Answers (1)

Maneesh
Maneesh

Reputation: 674

set a local const variable as

const url = {uri: this.state.uri + '?' + new Date()};

Use the url as follows:

<Image
source={uri}
/>

Upvotes: 1

Related Questions