xxxxxxxxxx
1. Download Font: https://fonts.google.com/
2. import at : project-directory/assets/fonts
3. Create file : ' react-native.config.js '
4. Paste this
module.exports = {
project: {
ios: {},
android: {}
},
assets: ['./assets/fonts/']
}
5. Run command : 'npx react-native-asset'
6. Restart App
xxxxxxxxxx
// 1) Install two package from expo
// 1.1) visit https://directory.vercel.app/ and select font you want
// expo install @expo-google-fonts/FONT_FAMILY_NAME
//For example, if you choose to use lato we would install:
//====== expo install @expo-google-fonts/lato =======
//1.2) =====expo install expo-app-loading ===========
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { AppLoading } from "expo-app-loading";
import {
useFonts,
Roboto_400Regular,
Roboto_400Regular_Italic
} from "@expo-google-fonts/roboto";
export default function App() {
let [fontsLoaded] = useFonts({
Roboto_400Regular,
Roboto_400Regular_Italic
});
if (!fontsLoaded) {
return <AppLoading />;
} else {
return (
<View style={{flex: 1, alignItems: "center", justifyContent: "center" }}>
<Text style={{ fontFamily: "Roboto_400Regular", fontSize: 28 }}>
Nice! Support for Google Fonts!
</Text>
</View>
);
}
}
xxxxxxxxxx
1. Download Font: https://fonts.google.com/
2. import at : project-directory/assets/fonts
3. Creat file : ' react-native.config.js '
4. Paste this
module.exports = {
project: {
ios: {},
android: {}
},
assets: ['./assets/fonts/']
}
5. Run command : ' npx react-native-asset'
6. Restart App