When react-native imports pictures, you can only use require, not import.

if you want to assign a variable, you can only require

let shapeBack = require("./public/img/shapeBack.png");

then introduce

into the source in the Image component

but before, when we wrote react to import pictures, we used import,rn but not import in it. Why?


first of all, let's come to the conclusion that import is OK.
you can write
import xx from 'xx.png'
and then Image src fill in this xxx

this is fine.


import is the ES6 syntax and can be used in react because your webpack indirectly uses babel
require is the CJS syntax, and node only supports this

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e59979-44ccf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e59979-44ccf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?