我尝试通过输入以下内容在我的RN应用中添加图像:
render()
{
return (
<View style ={styles.container}>
<Image source= {require('/home/app/app/components/images/ff.png')} style = {{height: 200, width: 250, resizeMode : 'stretch',}} />
但是我得到了这个错误
我尝试使用./ff.png
,但我得到了同样的错误。
感谢任何帮助
答案 0 :(得分:3)
试试这个:
<Image source= {require('./images/ff.png')} style = {{height: 200, width: 250, resizeMode : 'stretch'}} />
看起来这是正确的道路。