How to use expo-font - 10 common examples

To help you get started, we’ve selected a few expo-font examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EvanBacon / Lego-Expo / App.js View on Github external
async function loadResourcesAsync() {
  await Promise.all([
    Asset.loadAsync([
      require('./assets/images/robot-dev.png'),
      require('./assets/images/robot-prod.png'),
    ]),
    Font.loadAsync({
      // This is the font that we are using for our tab bar
      ...Ionicons.font,
      // We include SpaceMono because we use it in HomeScreen.js. Feel free to
      // remove this if you are not using it in your app
      'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'),
    }),
  ]);
}
github lightninglabs / lightning-app / mobile / App.js View on Github external
import 'node-libs-react-native/globals';
import { Platform, StyleSheet } from 'react-native';
import * as Font from 'expo-font';

// Configure expo-font to load .ttf files
// See: https://github.com/expo/expo/tree/master/packages/expo-font
StyleSheet.setStyleAttributePreprocessor('fontFamily', Font.processFontFamily);

// Polyfill ECMAScript Internationalization API on Android
// See: https://github.com/facebook/react-native/issues/19410
if (Platform.OS === 'android') {
  require('intl');
  require('intl/locale-data/jsonp/en-US');
}

import App from '../src/view/main-mobile';

module.exports = App;
github lightninglabs / lightning-app / mobile-bare / App.js View on Github external
import 'node-libs-react-native/globals';

// Polyfill ECMAScript Internationalization API on Android
// See: https://github.com/facebook/react-native/issues/19410
import 'intl';
import 'intl/locale-data/jsonp/en-US';

import { StyleSheet } from 'react-native';
import * as Font from 'expo-font';
StyleSheet.setStyleAttributePreprocessor('fontFamily', Font.processFontFamily);

import App from '../src/view/main-mobile';

module.exports = App;
github EvanBacon / apple-notes / App.js View on Github external
(async () => {
      try {
        await Promise.all([
          Font.loadAsync(Ionicons.font),
        ]);
      } catch (e) {
        console.log({ e });
      } finally {
        setLoaded(true);
      }
    })()
  });
github wcandillon / can-it-be-done-in-react-native / the-10-min / src / components / LoadAssets.tsx View on Github external
const useLoadAssets = (assets: number[], fonts: FontSource): boolean => {
  const [ready, setReady] = useState(false);
  usePromiseAll(
    [Font.loadAsync(fonts), ...assets.map(asset => Asset.loadAsync(asset))],
    () => setReady(true)
  );
  return ready;
};
github janaagaard75 / expo-and-typescript / src / FontScreen.tsx View on Github external
private async loadFont() {
    await Font.loadAsync({
      "PokerKings-regular": require("../assets/PokerKings-Regular.ttf")
    });

    this.setState({
      fontLoaded: true
    });
  }
github expo / expo / apps / native-component-list / instagram / screens / CameraScreen.js View on Github external
async componentDidMount() {
    Dimensions.addEventListener('change', this.onResize);

    try {
      await Permissions.askAsync(Permissions.CAMERA);
      await Font.loadAsync({
        'insta-strong': Assets.fonts['insta-strong.otf'],
        'insta-neon': Assets.fonts['insta-neon.otf'],
        'insta-typewriter': Assets.fonts['insta-typewriter.ttf'],
        'insta-modern': Assets.fonts['insta-modern.ttf'],
      });
    } catch (error) {
    } finally {
      this.setState({ ready: true });
    }
  }
github calebnance / expo-uber / src / constants / functions.js View on Github external
const cacheFonts = fonts => fonts.map(font => Font.loadAsync(font));
github internxt / X-Cloud-Mobile / src / helpers / loadFonts.js View on Github external
function loadFontsAsync() {
  return Font.loadAsync({
    "CerebriSans-Bold": require("../../assets/fonts/CerebriSans-Bold.ttf"),
    "CerebriSans-Medium": require("../../assets/fonts/CerebriSans-Medium.ttf"),
    "CerebriSans-Regular": require("../../assets/fonts/CerebriSans-Regular.ttf"),
    "CircularStd-Bold": require("../../assets/fonts/CircularStd-Bold.ttf"),
    "CircularStd-Black": require("../../assets/fonts/CircularStd-Black.ttf"),
    "CircularStd-Book": require("../../assets/fonts/CircularStd-Book.ttf"),
    "CircularStd-Medium": require("../../assets/fonts/CircularStd-Medium.ttf")
  });
}

expo-font

Load fonts at runtime and use them in React Native components.

MIT
Latest version published 3 days ago

Package Health Score

89 / 100
Full package analysis