react-native-svgs-to-icon

1.0.4 • Public • Published

react-native-svgs-to-icon

npm version npm npm All Contributors

Example

Installation

NPM

  • Add install peer dependencies

    yarn add -D patch-package webpack-iconfont-plugin-nodejs react-native-asset react-native-svgs-to-icon
    
  • Add this to react-native.config.js

    module.exports = {
      'react-native-svgs-to-icon': {
        output: './src/components', // icon components output destination
        input: './svgs', // svgs folder input destination
        fontOutput: './fontOutput', // font output destination could put this folder into .gitingore
        fontName: 'MyFont', // font name
        fontOutputCopyTo: './src/assets/fonts', // copy font to assets/fonts
      },
      assets: ['./src/assets/fonts'],
    };
  • Add this into postinstall

    "postinstall": "react-native-svgs-to-icon init && patch-package && react-native-svgs-to-icon generate && react-native-asset"
    
  • Rebuild app with yarn ios

  • Usage:

    export default function App() {
      return <Icon name="keyboard_double_arrow_up" style={{ marginTop: 100 }} size={24} color="green" />;
    }

Dependencies (8)

Dev Dependencies (4)

Package Sidebar

Install

npm i react-native-svgs-to-icon

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

9.75 kB

Total Files

9

Last publish

Collaborators

  • namnh240795