Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unrecognized Font Family on React Native

I'm running into a peculiar error using React Native. Inside my button.js I am doing

import Icon from "react-native-vector-icons/MaterialIcons";
const icon = (Icon name="menu size={20} color="green"/>);
render()
    return(
         {icon}
    )

But I'm given the error

Unrecognized Font Family 'Material Icons'

However when I import FontAwesome as:

import Icon from "react-native-vector-icons/FontAwesome";

I get no error.

like image 689
omriki Avatar asked Nov 27 '22 22:11

omriki


1 Answers

The same issue was fixed after triggering loadFont() method

import Icon from 'react-native-vector-icons/FontAwesome';

Icon.loadFont();
like image 134
NuOne Avatar answered Nov 29 '22 11:11

NuOne