android - 如何在我的 React Native 应用程序中显示 gif?

标签 android react-native

我用 react-native init AwesomeProject 创建了一个应用。

尽管按照 https://facebook.github.io/react-native/docs/image.html 中的说明进行操作,但我无法显示 gif .当我注释掉 compile 'com.facebook.fresco:animated-gif:1.8.1' 时,我的应用程序运行正常。

我的 build.gradle 依赖部分:

dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile 'com.facebook.fresco:animated-gif:1.8.1' // For animated GIF support
}

我正在使用 Windows 10 和针对 8.1 的 Android 模拟器。当我运行 react-native run-android 时,出现错误“AwesomeProject 已停止”。

最佳答案

你应该试试这个来显示 .gif

这是最好的。

https://github.com/airbnb/lottie-react-native

关于android - 如何在我的 React Native 应用程序中显示 gif?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49841870/

相关文章:

java - 为什么 context.startActivity(intent) 没有启动 Activity 以及如何在 android 中处理异常?

android - 等待数据库插入,Kotlin Coroutine

Android:接收系统发送的 Intent ACTION_PACKAGE_RESTARTED

javascript - React Native 某些样式导致 View 无法渲染

javascript - 如何在 React Native 中设置 props 的默认值

android - 以编程方式断开android Marshmallow版本中的调用

android - 如何将相机捕获的图像传递到android中的下一个屏幕?

javascript - 在 fetch React-Native 中返回代码

react-native - react 原生基本标题中心对齐

javascript - 有没有办法让 "onPress"和 "onLongPress"在同一个 "Button/TouchableOpacity"上