react-native使用gif动图
默认情况下 Android 是不支持 GIF 和 WebP 格式的。
·
一、配置
默认情况下 Android 是不支持 GIF 和 WebP 格式的。你需要在
android/app/build.gradle
文件中根据需要手动添加以下模块:dependencies { // 如果你需要支持Android4.0(API level 14)之前的版本 implementation 'com.facebook.fresco:animated-base-support:1.3.0' // 如果你需要支持GIF动图 implementation 'com.facebook.fresco:animated-gif:2.5.0' // 如果你需要支持WebP格式,包括WebP动图 implementation 'com.facebook.fresco:animated-webp:2.5.0' implementation 'com.facebook.fresco:webpsupport:2.5.0' // 如果只需要支持WebP格式而不需要动图 implementation 'com.facebook.fresco:webpsupport:2.5.0' }
二、使用
<Image source={require('../../assets/images/11.gif')}/>
更多推荐
所有评论(0)