Require .avif Image not work: None of these files exist...
Describe the bug
I just tested local images, .avif, .png and .webp formats, only avif format is facing problems. All of them are working fine coming from server.
To Reproduce
Use this package with local .avif image.
Note: This was tested only on iOS simulator, cannot test it on Android devices yet.
<FastImage
// attempt 1
source={require('./profile.avif')}
// attempt 2
// source={{
// uri: Image.resolveAssetSource(require('@assets/shared/images/profile.avif')).uri,
// }}
// attempt 3
//source={{ uri: Image.resolveAssetSource(require('./profile.avif')).uri }}
resizeMode={FastImage.resizeMode[resizeMode || 'contain']}
style={{
width: 40, height: 40, borderRadius: 30, padding: 10,
}}
/>
Expected behavior
- Should display local .avif image.
- url works:
https://aomedia.org/assets/images/blog/parrot-avif.avifor any other url - local paths don't work:
@assets/shared/images/profile.avifor./profile.avif
I'm pretty sure path file is correct and it exists.
Screenshots
Dependency versions
- React Native version: 0.78.0
- React version: 19.0.0
- React Native Fast Image version: 8.9.2
- Hermes and New arch enabled
I saw your issue randomly on the internet and wanted to try to contribute by explaining that minimum support for the AVIF format only arrived in Android 12 with a definitive one only in 14
If your emulator/physical device is running Android 11 or less, it will not work
On the iOS side, the minimum is 16