UNPKG

1.83 kBMarkdownView Raw
1# expo-font
2
3Load fonts at runtime and use them in React Native components.
4
5# API documentation
6
7- [Documentation for the master branch](https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/sdk/font.md)
8- [Documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/font/)
9
10# Installation in managed Expo projects
11
12For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](#api-documentation). If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
13
14# Installation in bare React Native projects
15
16For bare React Native projects, you must ensure that you have [installed and configured the `react-native-unimodules` package](https://github.com/unimodules/react-native-unimodules) before continuing.
17
18### Add the package to your npm dependencies
19
20```
21npm install expo-font
22```
23
24### Configure for JavaScript
25
26We're planning on handling this automatically in the future, but for now you'll need to set `Font.processFontFamily` as a preprocessor for `StyleSheet`. Add the following code to the top of your `App.js`:
27
28```js
29import * as Font from 'expo-font';
30import { StyleSheet } from 'react-native';
31StyleSheet.setStyleAttributePreprocessor('fontFamily', Font.processFontFamily);
32```
33
34### Configure for iOS
35
36Run `pod install` in the ios directory after installing the npm package.
37
38### Configure for Android
39
40No additional set up necessary.
41
42# Contributing
43
44Contributions are very welcome! Please refer to guidelines described in the [contributing guide]( https://github.com/expo/expo#contributing).