Answers for "how to add fonts react native"

5

custom font in react native

create folder in your root directory assets/Fonts and add your custom fonts
you want.
create a file in root folder and called react-native.config.js
Add the following code to the file =>

module.exports = {
project: {
    ios: {},
    android: {},
},
assets: ['./assets/Fonts']
};


or 
module.exports = {
    assets: ['./assets/Fonts'],
  };


Then, run the following command in your terminal:
react-native link 

to use it declare this way in your styles:
fontFamily: 'your-font-name without extension'

If your font is Raleway-Bold.ttf then,
  fontFamily: 'Raleway-Bold'
Posted by: Guest on February-13-2021
1

how to link custom fonts in react native

$ react-native link
Posted by: Guest on January-05-2021
0

how to add fonts react native

import React from 'react';
import { View, Text } from 'react-native';
import AppLoading from 'expo-app-loading';
import { useFonts, Inter_900Black } from '@expo-google-fonts/inter';

export default function App() {
  let [fontsLoaded] = useFonts({
    Inter_900Black,
  });

  if (!fontsLoaded) {
    return <AppLoading />;
  } else {
    return (
      <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
        <Text style={{ fontFamily: 'Inter_900Black', fontSize: 40 }}>Inter Black</Text>
      </View>
    );
  }
}
Posted by: Guest on October-05-2021

Code answers related to "how to add fonts react native"

Code answers related to "Javascript"

Browse Popular Code Answers by Language