react-native-svg-flagkit
react-native-svg-flagkit provides 250 flags to easily use in react-native.
Assets are all from FlagKit.
Inspired from FlagKit & react-native-svg & svgr.
Installation
npm install --save @mfauzanap/react-native-svg-flagkit
react-native-svg-flagkit depends on react-native-svg.
react-native link react-native-svg
Usage
import { Flag } from '@mfauzanap/react-native-svg-flagkit'
export default class App extends Component {
render() {
return (
<View>
<Flag
id={'TW'}
/>
<Flag
id={'US'}
size={0.2}
/>
<Flag
id={'JP'}
width={100}
height={100}
/>
</View>
);
}
}
Props
Prop | Type | Default | Note |
---|---|---|---|
size |
number |
1 | scale from default with, height |
width |
number |
210 | SVG or Image width |
height |
number |
150 | SVG or Image width |
onPress |
function |
Press flag event |
Run example
git clone git@github.com:jackmew/react-native-svg-flagkit.git
cd example
npm install
Run react-native-svg-flatkit/example/TestFlagKit.js
Todo
- [ ] Square Flag
- [ ] Circle Flag
Flags
Due to there is a react-native-svg Mask Component issue.
There are some svg component is not available currently.
When you use Flag component, it will automatically to use PNG to replace SVG.
The only problem is that when you try to scale PNG, it will be fuzzy.