STEP 1:
1. In your assets folder (or anywhere you prefer) create a new 'fonts' folder.
2. Go to https://fonts.goog...
For further actions, you may consider blocking this person and/or reporting abuse
Hey, thanks for you article !
However I still have the same error ("fontFamily : 'OpenSans-SemiBold" is not a system font and has not been loaded through Font.loadAsync")... I don't understand why, I have checked and re-checked my code but it still doesn't work. Can you help me to figure it out ?
screen of my code:
drive.google.com/file/d/1filV2ZK9Y...
Im using this method with Expo react native:
first install the relative npm packages, in my case im using "tajawal" font
in App.js:
Then
then i pass (TajawalFontFamily ) as prop to my component
in Home component:
Hi Emma, I'm Katie, welcome to the DEV community!
I see you are new here and already asking questions which is great!
I'm sure you'll find lots of help and support on DEV for all your coding needs.
Me too, same stetps and same error. Did you solve it Emma?
thanks
Im using this method with Expo react native:
first install the relative npm packages, in my case im using "tajawal" font
in App.js:
Then
then i pass (TajawalFontFamily ) as prop to my component
in Home component:
Dear Emma & Alex,
Sorry for the late reply. You can download a version from my github, compare it with your code and try for yourself. :)
github.com/edobegagic/loadfont
Hope this helps :)
hi , this is work correctly , useEffect
import React, { useState, useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import TextTraning from './Component/L001_Text';
import * as font from 'expo-font';
import { AppLoading } from 'expo-font';
export default function App() {
useEffect(() => {
font.loadAsync({
'nazanin': require('./assets/fonts/BNazanin.ttf'),
'b-titr': require('./assets/fonts/BTitrBd.ttf'),
'yekan': require('./assets/fonts/BYekan.ttf'),
'zar': require('./assets/fonts/BZar.ttf'),
'roboto-bold': require('./assets/fonts/Roboto-Bold.ttf'),
'roboto-italic': require('./assets/fonts/Roboto-Italic.ttf'),
'roboto-regular': require('./assets/fonts/Roboto-Black.ttf')
})
},[])
return (
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#aaa',
alignItems: 'center',
justifyContent: 'center',
}
});
thank you
This was a cool shortcut. Thanks to the post owner
Thanks, very explained post, solved my problems!
hi this is work for me
useEffect
Great, thanks for your content.
Nice explanations , Very helpful for me
Thank you for this. It helped a great deal.
So there is no way to just have a global font that every tag will automatically use.
I found this;
npmjs.com/package/react-native-glo...
However, not font changes in globally. I think you should put fontFamily for every tags.
Hi , Emma & Alex
This solution worked for me
drive.google.com/file/d/1u0HzPNILU...