marella / material-icons

Latest icon fonts and CSS for self-hosting material design icons.
https://marella.github.io/material-icons/demo/
Apache License 2.0
305 stars 36 forks source link

How to use Material Icon in react native with expo? #46

Open KeflemTrindade opened 1 year ago

KeflemTrindade commented 1 year ago

I would like to use the icons listed here https://fonts.google.com/icons?icon.set=Material+Icons, no expo react native.

marella commented 1 year ago

I haven't used react-native or expo but it looks like it is possible to import SVGs directly using react-native-svg-transformer library. See expo docs.

Once you install and configure react-native-svg-transformer library you will be able to import Material Icons SVGs which are available in the @material-design-icons/svg package. You can import and use them as:

import Face from '@material-design-icons/svg/filled/face.svg';

<Face />;

There is an example for React in the README but the usage should be similar for React Native. Please let me know if it works.