react-native-global-font

1.0.3 • Public • Published

react-native-global-font npm version MIT Platform - Android and iOS

React Native apply custom font for iOS and Android

Installation

  • Add font file to your app assets/fonts/

  • Create react-native.config.js file in your react native project:

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

    npm install --save react-native-global-font
    npx react-native link
    
  • iOS: add to info.plist :

    <key>UIAppFonts</key>
    <array>
      <string>YourFontName.ttf</string>
    </array>
    

Usage

Go to your highest order component that contains your whole application.

import GlobalFont from 'react-native-global-font'
componentDidMount() {
   let fontName = 'YourFontName'
   GlobalFont.applyGlobal(fontName)
}

Readme

Keywords

none

Package Sidebar

Install

npm i react-native-global-font

Weekly Downloads

554

Version

1.0.3

License

MIT

Unpacked Size

3.67 kB

Total Files

4

Last publish

Collaborators

  • nguyenhuynghia