add some custom Font in my react-native project and I tried lots of different way but every time I got error massage :
Error fontFamily "someFont" is not system font and has not been loaded through Font.loadAsync
i've read this page and try this method too : https://docs.expo.io/guides/using-custom-fonts/
here is my package.json :
dependencies": {
"@use-expo/font": "^2.0.0",
"expo": "~40.0.0",
"expo-font": "~8.4.0",
"expo-status-bar": "~1.0.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
"react-native-web": "~0.13.12"
},
and this is my app.js
import React from 'react';
import WelcomeScreen from "./app/screens/WelcomeScreen";
import ViewImageScreen from "./app/screens/ViewImageScreen";
import * as Font from "expo-font";
import FullyText from "./app/screens/FullyText";
export default function App() {
const loadFont = () => {
return Font.loadAsync({
"someFont": require('./app/assets/fonts/IRANSans_Bold.ttf')
})
}
return <FullyText/>
}
and My fullyText is on another page :
import React from 'react';
import {Text} from "react-native";
import * as Font from "expo-font";
function FullyText(props) {
return (
<Text
style={{
top: 100,
right: 10,
fontFamily: "someFont",
fontWeight: 'bold',
}}>
Some random text
</Text>
);
}
export default FullyText;