伙计们,由于我在导入图像时遇到了问题,因此我需要在每种模式下显示不同的图像,但是尝试时会
<Image
href={require(`../../../assets/images/questions/${imageName}.png`)}//eslint-disable-line
/>
返回错误
Loading dependency graph, done.
error: bundling failed: src\components\OptionImage\index.js: src\components\OptionImage\index.js:Invalid call at line 39: require("../../../assets/images/questions/" + imageName + ".png")
尝试
<Image
href={require('../../../assets/images/questions/'+imageName+'.png')}
/>
返回错误
Loading dependency graph, done.
error: bundling failed: src\components\OptionImage\index.js: src\components\OptionImage\index.js:Invalid call at line 38: require('../../../assets/images/questions/' + imageName + '.png')
使用
<Photo
href={require('../../../assets/images/questions/default.png')}//eslint-disable-line
/>
可以使用,但是会得到无法更改的静态图像
谁能帮忙谢谢你。
答案 0 :(得分:0)
我在这里找到了这个问题的答案。谢谢你们 https://github.com/react-native-community/react-native-svg/issues/1204