Rushabh Rakholiya
Rushabh Rakholiya

Reputation: 415

where to upload assets image in react native?

I'm working with react-native maps and want to add custom image for marker where we have add this code

import flagPinkImg from './assets/flag-pink.png';

unable to understand that where assets folder exactly placed

could anyone help me in, it would be best with detailed description which very helpful for me to understand core execution of react native.

Upvotes: 1

Views: 2387

Answers (1)

martinarroyo
martinarroyo

Reputation: 9701

The assets folder in this particular case is located in the same directory as the file where the import statement. What the dot before /assets means is precisely that. This is not exclusive of React Native, but the system for traversing the directory tree in a filesystem in a Unix system (It works on Windows systems as well for this particular case). You can also do '..' to refer to the upper level in the hierarchy, or '~' to point to your home directory (usually not needed in your case).

So, specifically to this case, your structure should look like this:

myProjectRootFolder
| myFileWithImportStatement.js
| assets
| | flag-ping.png

Upvotes: 1

Related Questions