Socket
Book a DemoInstallSign in
Socket

react-native-country-flag

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-country-flag

This is a React-Native package to display every 254 Country flags with the ISO 3166-1 alpha-2 Standard!

2.0.2
latest
Source
npmnpm
Version published
Weekly downloads
15K
-19.13%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-country-flag

This is a react-native package to display every 254 country flag with the ISO 3166-1 alpha-2 Standard!

preview image

NPM Npm package total downloads

📖 Table of Contents

 

⬇️ Install package

npm install --save react-native-country-flag

 

💾 Data

Data required for the countryflag component to work has been completely decoupled from the library. That gives developers the flexibility to better control their app bundle size and let them choose how and when this data is loaded. Data can be:

Usage with remotely Fetched flags

  • Pros: Data fetched only when needed, does not affect your app bundle size
  • Cons: Network latency, doesn’t work offline
import CountryFlag from "react-native-country-flag";

<CountryFlag isoCode="de" size={25} />

Usage with flags directly Bundled into your codebase

🚧 Note: Still in progress (probely available in v2.1)

  • Pros: Component renders instantly, data is available offline
  • Cons: Does affect your app bundle size
npm install --save react-native-country-flag/data
import CountryFlag from "react-native-country-flag";
import flags from "react-native-country-flag/data";

<CountryFlag isoCode="de" size={25} flags={flags} />

 

🚩 Flag component (props)

import CountryFlag from "react-native-country-flag";

<CountryFlag isoCode="de" size={25} />

You can only use the ISO 3166-1 alpha-2 Standard for the isoCode property.

PropTypeDesciption
isoCodeStringDefine the country flag with the ISO 3166-1 alpha-2 Standard.
sizeIntegerDefine the size from the country flag.
styleStylesheetCustomize the style from the CountryFlag component.
flagsOptional: pass bundeled flags CountryFlag component.

 

📝 License

MIT © Yannis Hofmann

Keywords

React-Native

FAQs

Package last updated on 04 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.