How to use custom fonts on Vue native?

573 views Asked by At

I'm trying to use a custom font on my vue native app, but dontt find how to do this. I've tried use @font-face.enter image description here

i found something like Font.loadAsync from react native, but i don't know how to use this

1

There are 1 answers

0
Alexandro Roca On

I been using expo documentation, perhaps this can leads you to a solution

Edit: Well after installing the given font package, I imported expo-font in my app.vue file then I loaded inside the google font package and that's all

//App.vue
import * as Font from "expo-font";

Font.loadAsync({
  VT323_Regular: require("./node_modules/@expo-google-fonts/vt323/VT323_400Regular.ttf"),
});

//export default { ...
.myText {
  font-family: VT323_Regular;
}
<template>
  <view class="container">
  
   <text class="myText">ABCDEF</text>
    
  </view>
</template>