oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.45k stars 2.12k forks source link

TypeError: _FontAwesome.default.getImageSource is not a function. #1452

Open mmg-mike opened 2 years ago

mmg-mike commented 2 years ago

Environment

macOS Monterey Version 12.4 react-native: 0.68.2 react-native-vector-icons: ^9.2.0 expo: ~45.0.0

Issue

When trying to use getImageSource I get the following error:

TypeError: _FontAwesome.default.getImageSource is not a function. (In '_FontAwesome.default.getImageSource('circle', 15, '#fff')', '_FontAwesome.default.getImageSource' is undefined)

Code

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

const [icon, setIcon] = useState();

useEffect(() => {
    Icon.getImageSource('circle', 15, '#fff').then(setIcon)
}, []);

Notes

I'm not sure if using functional components instead of classes could be the issue, but I'm not sure why that would matter.

Also, here's the link to the docs showing it's usage: https://github.com/oblador/react-native-vector-icons#usage-as-png-imagesource-object

phil-hudson commented 11 months ago

hey - did you ever resolve this? having the same issue