1.0.1 ā€¢ Published 1 year ago

react-native-add-font v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-add-font

This is a command-line utility for installing custom fonts in a React Native project.

Features

  • Rename font files to their PostScript name so it's consistent across platforms
  • Create ./assets/fonts and ./react-native.config.js if they don't exist
  • Use react-native-assets for easier unlinking later-on

Usage

npx react-native-add-font

It will prompt you to provide a ttf font file.

Example

$ npx react-native-add-font

What is the path to the font file? (You can drag and drop it here) /path/to/my/font.ttf

šŸ“ Ensuring font directory exists: ./assets/fonts
šŸ–Øļø Extracted PostScript name for font: MyFont-Regular
āœ… Copied font to ./assets/fonts/MyFont-Regular.ttf
šŸ“¦ Running react-native-asset

After building, you can use the font like this:
{ fontFamily: "MyFont-Regular"}
Or if you use styled-components:
font-family: MyFont-Regular;