UNPKG

react-native-flags-kit

Version:

React Native Flags Kit - React Native Flag component with all the flags in the world.

29 lines (23 loc) 596 B
import React from 'react'; import PropTypes from 'prop-types'; import { Image } from 'react-native'; import * as flags from './src'; const Flag = props => { const flag = flags[props.type][`icons${props.size}`][props.code]; const unknownFlag = flags[props.type][`icons${props.size}`]['unknown']; return ( <Image source={flag || unknownFlag} style={[{ width: props.size, height: props.size }, props.style]} /> ); }; Flag.propTypes = { size: PropTypes.number, type: PropTypes.string, }; Flag.defaultProps = { size: 64, type: "shiny", }; export default Flag;