Description
- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Images intermittently disappear on Android
Several issues reported in #13600 which was closed due to being stale but the issue still persists
Using RN 0.55 (can't use 0.56 due to babel 7 and jest mock incompatibilities)
Note / Possible Workaround
In my testing, this issue only occurs when importing images like:
<Image source={require('./my-icon.png')} />
But if I import via:
import myIcon from './my-icon.png';
then it works fine.
See the blog post Quick Tip: Images in React-Native on Android Not Loading for more on this.
Environment
Scanning folders for symlinks in /Users/aaronbrager/[REDACTED]/node_modules (17ms)
Environment:
OS: macOS 10.14
Node: 10.8.0
Yarn: 1.9.4
npm: 6.2.0
Watchman: 4.9.0
Xcode: Xcode 9.4.1 Build version 9F2000
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4
[skip envinfo]
Possible cause
fresco has a cache pool for decoded bitmap, with a default size determined by the available runtime memory:
When the amount of memory is insufficient it throws an exception:
When this happens, React Native eats the exception and fails silently (see line 71):
Instead of failing silently, React Native should do something (increase memory, free resources, clear cache… not sure) to ensure that the image being rendered appears.
Initial research done by @fatfatson (see #13600 (comment))