1 | # expo-font
|
2 |
|
3 | Load 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 |
|
12 | For 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 |
|
16 | For 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 | ```
|
21 | npm install expo-font
|
22 | ```
|
23 |
|
24 | ### Configure for JavaScript
|
25 |
|
26 | We'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
|
29 | import * as Font from 'expo-font';
|
30 | import { StyleSheet } from 'react-native';
|
31 | StyleSheet.setStyleAttributePreprocessor('fontFamily', Font.processFontFamily);
|
32 | ```
|
33 |
|
34 | ### Configure for iOS
|
35 |
|
36 | Run `pod install` in the ios directory after installing the npm package.
|
37 |
|
38 | ### Configure for Android
|
39 |
|
40 | No additional set up necessary.
|
41 |
|
42 | # Contributing
|
43 |
|
44 | Contributions are very welcome! Please refer to guidelines described in the [contributing guide]( https://github.com/expo/expo#contributing).
|