react-native-country-flags

1.1.0 • Public • Published

react-native-country-flags

Great way to import flag svgs dynamically

Why?

In reat-native you could not do dynamic imports. However, you could import all the files and then export a dictionary with the mappings. This will be useful when you have to work with a large amount of flags.

Generate imports

All flags are stored under flags directory. If you are lazy and do not want to add the imports by hand then run generator.py. It will output both the imports from flags like:

import AeFlag from './flags/ae.svg';

and flagMappings like:

ae: AeFlag,
ad: AdFlag,

All you have to do is to copy them in index.js and you are good to go.

Usage

import { flagMappings } from 'react-native-country-flags';

const Flag = flagMappings['ae'];

return <Flag width={24} height={24} style={...}/>

Readme

Keywords

none

Package Sidebar

Install

npm i react-native-country-flags

Weekly Downloads

50

Version

1.1.0

License

MIT

Unpacked Size

3.1 MB

Total Files

253

Last publish

Collaborators

  • mihaitoader
  • liviusl
  • adeelzahir
  • cristi.ingineru
  • cipix2000
  • alexandrukis
  • sectorlabs
  • photonios
  • ovidiu_s
  • alexsfirlea
  • _alexandrukis
  • dolha.dan