我目前正在使用React Native构建测试应用程序.到目前为止,Image模块一直运行良好.
例如,如果我有一个名为的图像avatar,下面的代码片段工作正常.
<Image source={require('image!avatar')} />
Run Code Online (Sandbox Code Playgroud)
但是,如果我将其更改为动态字符串,我会得到
<Image source={require('image!' + 'avatar')} />
Run Code Online (Sandbox Code Playgroud)
我收到错误:
Requiring unknown module "image!avatar". If you are sure the module is there, try restarting the packager.
显然这是一个人为的例子,但动态图像名称很重要.React Native不支持动态图像名称吗?

我正在使用react-native 0.28.0
我试图根据本教程在iPhone模拟器上显示图像:http://www.appcoda.com/react-native-introduction/
var styles = StyleSheet.create({
image: {
width: 107,
height: 165,
padding: 10
}
}
var imageURI = 'http://books.google.com/books/content?id=PCDengEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api'
Run Code Online (Sandbox Code Playgroud)
然后在render()函数中,我添加:
<Image style={styles.image} source={{uri:imageURI}} />
Run Code Online (Sandbox Code Playgroud)
为图像分配的空间在那里,但图像未显示.