Using custom fonts with React Native Expo shows errors sometimes and it is quite frustrating for such simple task. Sometimes you forget to import the correct package, at other times the font path is not correct.
To use this script, please download the fonts you want to use in your app in .ttf or .otf format, create a fonts directory in the assets folder and put all your fonts there.
Before trying anything, install expo-font package from expo CLI using following command, because sometimes expo-font version is not compatible with your expo version:
expo install expo-font
You will also need to install a package that provides a hook called useFonts, for that run the following command in your react-native project directory:
npm install --save @use-expo/font
Please see the code gist:
If you see any errors, make sure you have installed the useFonts package, stop the server with CTRL + c and and
npm start again
Hope that helps.