1.0.0 • Published 2 years ago

@forward-software/react-native-flags-kit v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-native-flags-kit

React Native Flag component with all the flags in the world

license Build & Test Language grade: JavaScript Github Issues

npm NPM downloads

react-native-flags-kit-example.gif

Installation

yarn add @forward-software/react-native-flags-kit

Usage

import { Flag } from '@forward-software/react-native-flags-kit';

<Flag code="DE" size={32} />

Props

PropsTypeRequiredDefaultDescription
codestringYESThe ISO code of a flag, for example "KH", "US" or "GB".
typeflat or shinyNoshinyDisplay the flags with a shiny or flat effect.
size16, 24, 32, 48, 64 or numberNo64The size of a flag in points (Note: Setting a different size will render the closest one - e.g. 17 -> 16, 29 -> 32).
styleNoAllows additional RN Image styles to be passed through.

Full Example

import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';

import { Flag } from '@forward-software/react-native-flags-kit';

export const App: React.FC = () => (
  <View style={styles.container}>
    <Flag code="US" size={64} />
    <Flag code="JP" size={64} />
    <Flag code="CN" size={64} />
    <Flag code="RU" size={64} />
    <Flag code="KH" size={64} />
    <Flag code="VN" size={64} />
    <Flag code="SG" size={64} />
    <Flag code="MY" size={64} />
  </View>
);

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
    fontSize: 30,
  },
});

For a more complete example check the example folder.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

Credits

This library is an update of react-native-flags-kit to make it work with latest React Native versions and fix old reported issues (e.g. #1)

License

MIT


Made with ✨ & ❤️ by ForWarD Software and contributors

If you found this project to be helpful, please consider contacting us to develop your React and React Native projects.