React Native Android本地映像

pra*_*pra 6 android react-native

我有这个

<Image style={styles.image} source={require('image!logo')}/>

哪里将logo.png添加到android/app/src/main/res文件夹中.

但图像没有显示(我已经重新运行react-native run-android).

我需要做一些其他的改变吗?

请注意,使用<Image source = {{uri:http:// path/to/image }} />有效.

小智 8

图像文件需要进入res下相应的drawable-xxx文件夹.

尝试投入logo.png,android/app/src/main/res/drawable-hdpi然后重建您的应用程序.

React Native网站上有一些信息:https://facebook.github.io/react-native/docs/image.html#adding-static-resources-to-your-android-app