Font Family React Native

Umar
Umar
Sep 3, 2018 · 2 min read
  1. Download ttf.
  2. Add font to assets ( new folder ).
  3. Edit package.json.
  4. Add font to android.
  5. React native styles.

Download ttf

Jika tidak menggunakan library untuk UI seperti native base yang artinya pure component, maka kita perlu dowload font untuk peroperti fontFamily pada style component kita.

Untuk ttf bisa kita donwload di sini.

Masuk tempat hasil donwload, yang biasanya ada di direktori Downloads , biasanya hasil dari donwloadnya adalah file zip, extract !

Add font to assets ( new folder )

Buat folder assets didalam folder project kita, lalu masukkan copy ttf ke dalamnya. Contoh diatas menggunakan DSMArkerFelt.ttf.

Edit package.json

Tambahkan code di atas kedalam file package.json

Kemudian kita link dengan react-native link

Add font to android

Di android, jika kita melihat ke file path android/app/src/main/assets/fonts/ maka kita akan melihat fontsnya sudah tercopy

React native styles

Done !

“Let’s get started” using Roboto-Thin font family

    Umar

    Written by

    Umar

    https://t.me/umarudy

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade