React-Native-Image 不播放完整的 gif
React-Native-Image not playing full gif
我这里有一张动图:
我的 index.ios.js
在这里:
return (
<View style={styles.container}>
<Image
style={{width: 200, height: 400}}
source={{uri: this.state.path}} />
</View>
但是输出是这样的:
关于如何让它播放整个 gif 有什么想法吗?
您的输出 gif 打开 Safari 而不是 iOS 应用程序。你能post尝试打开应用程序时输出gif吗?
您可能还想确认 this.state.path
的值,您正将其用作 gif
.
的来源
它需要有扩展名 .gif
才能工作。例如
<Image source={{uri: 'http://www.urltogif/image.gif'}} />
//or
<Image source={require('./path/to/image/local.gif')} />
您可以在此处找到工作示例https://snack.expo.io/ByglJIzD-
适合我,使用 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>
);
}
我这里有一张动图:
我的 index.ios.js
在这里:
return (
<View style={styles.container}>
<Image
style={{width: 200, height: 400}}
source={{uri: this.state.path}} />
</View>
但是输出是这样的:
关于如何让它播放整个 gif 有什么想法吗?
您的输出 gif 打开 Safari 而不是 iOS 应用程序。你能post尝试打开应用程序时输出gif吗?
您可能还想确认 this.state.path
的值,您正将其用作 gif
.
它需要有扩展名 .gif
才能工作。例如
<Image source={{uri: 'http://www.urltogif/image.gif'}} />
//or
<Image source={require('./path/to/image/local.gif')} />
您可以在此处找到工作示例https://snack.expo.io/ByglJIzD-
适合我,使用 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>
);
}