TypeError when trying to use a custom font.

I imported a custom font exactly as explained in the Expo docs but I’m getting this error message. What am I doing wrong?
TypeError: undefined is not a function (near ‘…_expo.default.loadAsync…’)

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import AuthScreen from './screens/AuthScreen';
import Font from 'expo';

export default class App extends React.Component {

  componentDidMount() {
    Font.loadAsync({
      'GlacialIndifference': require('./assets/fonts/GlacialIndifference-Regular.otf'),
    });
  }

  render() {
    return (
      <AuthScreen/>
    );
  }
}


Hey @jonaird,

You need to change the import statement to import { Font } from 'expo'.

Cheers,

Adam

1 Like

Thanks!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.