Use with a local file

前端 未结 10 827
醉梦人生
醉梦人生 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:22

    I was having trouble with react-native-navigation, I created my own header component, then inserted a image - as logo - on the left before title, then when I was triggering navigate to another screen and then back again, logo was loading again, with a timeout near 1s, my file were local. My solution :

    Logo.json

    {"file" : "base64 big string"}
    

    App.js

    import Logo from '.../Logo.json'
    ...
    
    

提交回复
热议问题