Trouble requiring image module in React Native

前端 未结 7 1958
别那么骄傲
别那么骄傲 2020-12-13 08:39

Just getting started with React-Native and I\'m having some trouble requiring a static image.

Here\'s the very-basic code I have so far:

\'use strict\'         


        
7条回答
  •  死守一世寂寞
    2020-12-13 09:11

    NOTE: App build required for new resources Any time you add a new resource to Images.xcassets you will need to re->build your app through XCode before you can use it - a reload from within >the simulator is not enough. (from React Native docs https://facebook.github.io/react-native/docs/image.html#content)

    Also make sure to restart the packager. That solved the issue for me.

提交回复
热议问题