React-Native-Image没有播放完整的GIF

时间:2017-08-04 19:17:14

标签: ios react-native gif

我在这里有一个GIF:

nsgif-15018727507

我的index.ios.js在这里:

return (
      <View style={styles.container}>
        <Image
          style={{width: 200, height: 400}}
          source={{uri: this.state.path}} />
      </View>

然而,这就是输出:

giphy

关于如何让它发挥整个GIF的任何想法?

2 个答案:

答案 0 :(得分:1)

您的输出gif打开了Safari而不是iOS应用程序。你试图打开应用程序时可以发布输出gif吗?

另外,您可能需要确认this.state.path的值gif的来源{/ 1}}。

它需要在其中使用扩展名.gif才能正常工作。例如

<Image source={{uri: 'http://www.urltogif/image.gif'}} /> 

//or

<Image source={require('./path/to/image/local.gif')} />

您可以在https://snack.expo.io/ByglJIzD-

找到一个有效的例子

答案 1 :(得分:0)

为我工作,使用React Native 0.47.1的新项目。

渲染功能如下所示:

render() {
    return (
      <View style={styles.container}>
        <Image style={{width: 200, height: 400}} 
               source={{uri: 'https://user-images.githubusercontent.com/13806068/28982817-ffd1fdc2-790b-11e7-9bc2-a2d1135ca232.gif'}}/>
      </View>
    );
  }
相关问题