Google Font di React Native
// 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>
);
}
}
Shirshak kandel