Image component with local uri source (file://) does not render initially
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 127k
- Forks
- 25.3k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
Image components with local uri sources (file://) do not render initially. When a re-render of the component tree happens, the images get rendered.
Environment
Environment:
OS: macOS High Sierra 10.13.1
Node: 8.9.1
Yarn: 1.3.2
npm: 5.5.1
Watchman: 4.9.0
Xcode: 9.1 (9B55)
Android Studio: 3.0.1
Packages: (wanted => installed)
react-native: 0.51.0 (@sraka1 reports this is still an issue in 0.58.4)
react: 16.0.0
Target Platform: Android (5.0.0)
Steps to Reproduce
const image = {uri: 'http://my.bamps.online/cfs/files/images/D8Xg27puAiqjvKetD?store=normal'}
// image2 is cached version of image by react-native-cached-image
const image2 = {uri: 'file:///data/data/com.testcachedimage/cache/imagesCacheDir/my_bamps_online_e6d51c26611343fb5e8c3e493674423c3d3f3943/38baef384cbb5bcc5f6138ca0653884561f85fde.jpg'}
export default class App extends Component<{}> {
render() {
return (
<View style={{backgroundColor:'#777'}}>
<Image source={image2} style={{width: 100, height: 100}}/>
<Image source={image2} style={{width: 300, height: 100}}/>
<ImageBackground source={image2} style={{width: 100, height: 100}}/>
<ImageBackground source={image2} style={{width: 300, height: 100}}/>
<Image source={image} style={{width: 100, height: 100}}/>
<Image source={image} style={{width: 300, height: 100}}/>
</View>
);
}
}
Actual Behavior

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Android reproduction using Image and ImageBackground with file:// sources, then trace the initial rendering path for these components. Done means cached local images render on the first component render without requiring a later tree re-render; verify both image sizes and component types from the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100