无法解析模块映像反应原生

时间:2017-07-11 14:49:30

标签: react-native

我尝试通过输入以下内容在我的RN应用中添加图像:

render()
{
return (
 <View style ={styles.container}>
    <Image source= {require('/home/app/app/components/images/ff.png')}  style = {{height: 200, width: 250, resizeMode : 'stretch',}} />

但是我得到了这个错误

enter image description here

我尝试使用./ff.png,但我得到了同样的错误。

感谢任何帮助

1 个答案:

答案 0 :(得分:3)

试试这个:

<Image source= {require('./images/ff.png')}  style = {{height: 200, width: 250, resizeMode : 'stretch'}} />

看起来这是正确的道路。