我目前正在使用 React Native 构建一个测试应用程序。 图像模块,到目前为止都挺好
例如,如果我有一个名为avatar的图片,下面的代码片段可以很好地完成任务。
<Image source={require('image!avatar')} />
但是如果我把它变成一个动态字符串,就成了
<Image source={require('image!' + 'avatar')} />
出现一个error:
Requiring unknown module "image!avatar". If you are sure the module is there, try restarting the packager.
React Native 不支持动态映像名称吗?