Repository navigation
Description
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment:
OS: macOS Sierra 10.12.6
Node: 8.9.3
Yarn: Not Found
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed)
react: ^16.0.0 => 16.0.0
react-native: ^0.51.0 => 0.51.0
Steps to Reproduce
(Write your steps here:)

Precondition: images was saved in local before.
- Name images as 1,2,3,4 for easily tracking
- Display images in FlatList as Gif above (Image component must have same width and height)
- Change the name of image 4.jpg to 5.jpg and 3.jpg to 4.jpg
Expected Behavior
Image 3.jpg after rename to 4.jpg display correct image
Actual Behavior
I think RCTImageCache was fetched wrong image because of NSString *cacheKey = RCTCacheKeyForImage(url, size, scale, resizeMode, responseDate); line. In the example above. suppose data1 is 4.jpg and data2 is 3.jpg. so when we change 4.jpg to 5.jpg, we have cached data1 with file:///xxx/documents/downloads/4.jpg and file:///xxx/documents/downloads/4.jpg keys.(file:///xxx/documents/downloads/xxx.jpg is absolute path to image). Then when change 3.jpg to 4.jpg it will fetched data1 with file:///xxx/documents/downloads/4.jpg key (which was saved by another image before). So wrong image was fetched
I think the bug can be fixed if Image component support keyExtractor like FLatList for cache-key
Reproducible Demo
The instructions I have give in the give above.
(I'm sorry for my bad english)
Activity
react-native-bot commentedon Feb 24, 2018
Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?
I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.
How to Contribute • What to Expect from Maintainers
salmanwaheed commentedon Feb 24, 2018