expo-starter
expo-starter copied to clipboard
how to import assets
i couldn't figure out how to import assets in this project, what i ended up doing was:
- put my assets (like .pngs) in
assets
dir, - added this to
tsconfig.json
"paths": {
...,
"@assets/*": [
"assets/*"
]
}
- created a
react-app-env.d.ts
insidesrc
dir:
declare module "*.png";
declare module "*.svg";
declare module "*.jpeg";
declare module "*.jpg";
and finally i could import my assets:
import examplePng from "@assets/example.png"
but i am wondering if i did too much work and there's another intended way to do this? i figured there might be something i missed in the starter project if this was taken into consideration, thanks!