Trouble requiring image module in React Native

前端 未结 7 1926
别那么骄傲
别那么骄傲 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:31

    For static images, you need to provide the path like:

    <Image source={require('./images/back.png')}  
    style= {{width:25, height:25, marginLeft:12, padding:12}}/>
    

    This worked for me, for the image stored in images folder of project directory:

    0 讨论(0)
提交回复
热议问题