Use with a local file

前端 未结 10 944
醉梦人生
醉梦人生 2021-02-01 01:56

The documentation says that the only way to reference a static image is to use require.

But I\'m not sure where does react expect to have those images. The examples don

10条回答
  •  迷失自我
    2021-02-01 02:12

    You have to add to the source property an object with a property called "uri" where you can specify the path of your image as you can see in the following example:

    
    

    remember then to set the width and height via the style property:

    var styles = StyleSheet.create({
       image:{
        width: 360,
        height: 40,
      }
    });
    

提交回复
热议问题