1create folder in your root directory assets/Fonts and add your custom fonts
2you want.
3create a file in root folder and called react-native.config.js
4Add the following code to the file =>
5
6module.exports = {
7project: {
8 ios: {},
9 android: {},
10},
11assets: ['./assets/Fonts']
12};
13
14
15or
16module.exports = {
17 assets: ['./assets/Fonts'],
18 };
19
20
21Then, run the following command in your terminal:
22react-native link
23
24to use it declare this way in your styles:
25fontFamily: 'your-font-name without extension'
26
27If your font is Raleway-Bold.ttf then,
28 fontFamily: 'Raleway-Bold'
1import React from 'react';
2import { View, Text } from 'react-native';
3import AppLoading from 'expo-app-loading';
4import { useFonts, Inter_900Black } from '@expo-google-fonts/inter';
5
6export default function App() {
7 let [fontsLoaded] = useFonts({
8 Inter_900Black,
9 });
10
11 if (!fontsLoaded) {
12 return <AppLoading />;
13 } else {
14 return (
15 <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
16 <Text style={{ fontFamily: 'Inter_900Black', fontSize: 40 }}>Inter Black</Text>
17 </View>
18 );
19 }
20}
21