In cmd:
expo install expo-font
expo install expo-app-loading
import React, { useState } from "react";
import { StyleSheet, Text, View } from "react-native";
import * as Font from "expo-font";
import AppLoading from "expo-app-loading";
const fetchFonts = () => {
return Font.loadAsync({
"open-sans": require("./assets/fonts/OpenSans-Regular.ttf"),
"open-sans-bold": require("./assets/fonts/OpenSans-Bold.ttf")
});
};
export default function App() {
const [fontsLoaded, setFontsLoaded] = useState(false);
if (!fontsLoaded) {
return (
<AppLoading
startAsync={fetchFonts}
onFinish={() => setFontsLoaded(true)}
onError={console.log("Hata geçekleşti")}
/>
);
}
return (
<View style={styles.screen}>
<Text style={styles.text}>
Open up App.js to start working on your app!
</Text>
</View>
);
}
const styles = StyleSheet.create({
screen: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
text: {
fontFamily: "open-sans-bold",
fontSize: 18,
},
});