I am getting issue(attached screenshot) while loading & using custom font in react native expo project. I tried all ways to fix but didn't get a proper solution. One surprising thing I found it that when created a new project and used font there by loading, It's working there but not working in project app. What may be issue? I have tried all steps of Restarting server, System, Reinstalling expo app but none of them worked.
import React, { useState } from 'react';
import { AppLoading } from 'expo'
import * as Font from 'expo-font'
const fetchFonts = () => {
return Font.loadAsync({
'SansPro-regular': require('./assets/fonts/SourceSansPro-Regular.ttf'),
'SansPro-light': require('./assets/fonts/SourceSansPro-Light.ttf'),
'SansPro-SemiBold': require('./assets/fonts/SourceSansPro-SemiBold.ttf'),
'SansPro-Bold': require('./assets/fonts/SourceSansPro-Bold.ttf')
})
}
export default function App() {
const [fontLoaded, setFontLoaded] = useState(false)
if (!fontLoaded) {
return (
<AppLoading startAsync={fetchFonts} onFinish={() => {
setFontLoaded(true)
}}
/>
)
}
return (
<View>
<Text style = {{fontFamily: 'SansPro-Bold'}}>Welcome to react native</Text>
</View>
);
}