Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

expo font install

npx expo install expo-font
Comment

expo custom fonts

$ expo install expo-font @expo-google-fonts/inter
Comment

expo font

// How to add custom fonts to react native expo project
// 1 put your font.ttf file in: yourProjectFolder/assets/fonts/FontFile.ttf

// 2 Add this import
import { useFonts } from 'expo-font';

// 3 Add this hook to your component:
    const [loaded] = useFonts({   // make sure path is correct
        MyFontName: require('../assets/fonts/FontFile.ttf'),
    });   

// 4 then use it in your style sheet like this:
const styles = StyleSheet.create({
    myText:{
        fontFamily: 'MyFontName',
    },
});
// hope it helped :)

// IF THIS DOESNT WORK, TRY THIS
// 1 create "react-native.config.js" file in your project folder
// 2 copy this code to the file:
module.exports = {
    assets: ['./assets/fonts'],
};
// 3 open new terminal, and run (React >= 0.6.9):
npx react-native-asset
// or for older react-native versions: 
npx react-native link
// 4 now restart your expo app and it should work
Comment

PREVIOUS NEXT
Code Example
Javascript :: js reverse number 
Javascript :: Accessing Object Properties with Variables 
Javascript :: add background image react native 
Javascript :: node 10 form data 
Javascript :: iterate loop over mapping in solidity 
Javascript :: js select get all options value 
Javascript :: foeach in js 
Javascript :: check number javascript 
Javascript :: this in javascript 
Javascript :: Using Then To Create A Promise In JavaScript 
Javascript :: how to push two values in array at once 
Javascript :: string padStart padEnd 
Javascript :: reduce to calculate sum react 
Javascript :: js reverse a strings in array 
Javascript :: angular get class list for element 
Javascript :: redux store 
Javascript :: javascript break with Nested Loop 
Javascript :: does pycharm support javascript 
Javascript :: json to array javascript 
Javascript :: javascript array multidimensional push 
Javascript :: javascript encryption decryption 
Javascript :: js add to array 
Javascript :: jquery find and replace text 
Javascript :: AngularJS how to use btn-group or radio group in list 
Javascript :: js base64 encode 
Javascript :: create multiple images in js 
Javascript :: javascript check table not empty 
Javascript :: js how to see console day tomorrow 
Javascript :: mongoose encrypt password 
Javascript :: How to end a session in ExpressJS 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =