GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - gitamego/react-native-fontify: Dynamically load fonts in React Native! Elevate your UI with on-the-fly typography.

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

12 Commits
12 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.yarn
.yarn
 
 
android
android
 
 
example
example
 
 
ios
ios
 
 
lib
lib
 
 
scripts
scripts
 
 
src
src
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.nvmrc
.nvmrc
 
 
.watchmanconfig
.watchmanconfig
 
 
.yarnrc.yml
.yarnrc.yml
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
babel.config.js
babel.config.js
 
 
lefthook.yml
lefthook.yml
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
react-native-fontify.podspec
react-native-fontify.podspec
 
 
tsconfig.build.json
tsconfig.build.json
 
 
tsconfig.json
tsconfig.json
 
 
turbo.json
turbo.json
 
 

Repository files navigation

react-native-fontify

Dynamically load fonts in React Native! Elevate your UI with on-the-fly typography.

Installation

npm install react-native-fontify

iOS

npx pod-install ios

Methods

import { hasFont, registerFontFromFile } from 'react-native-fontify';

hasFont()

Check if a font exists in the system.

const result = await hasFont('Poppins'); // Check if the Poppins font exists in the system.

registerFontFromFile()

Register a font file in the system.

import RNFS from 'react-native-fs'; // Use the `react-native-fs` library to download and access the system's cache directory.

const [updated, setUpdated] = useState(false);

// iOS
const postScriptName = await registerFontFromFile(
  RNFS.CachesDirectoryPath + '/Poppins.ttf'
); // Load the Poppins font from the cache directory. This returns the postscript name of the font.

// Android
const postScriptName = await registerFontFromFile(
  RNFS.CachesDirectoryPath + '/Poppins.ttf',
  'Poppins', //Specify family name to be registered
); // Load the Poppins font from the cache directory. This returns the postscript name of the font.

const result = await hasFont(postScriptName); // True
setUpdated(true); // Make sure to update the state after registration.

If the font has already been registered, it returns the postScriptName.

Don't forget to update all <Text /> or <TextInput /> components to apply the new font.

Error Code

Code Description
ERR_FILE_NOT_FOUND If the font has not been found on the given path
ERR_FONT_LOAD Error while loading a font file
ERR_FONT_REGISTRATION_UNKNOWN Unknown error (check errorMessage for description)
ERR_FONT_REGISTRATION Error while registering the font in the system (check errorMessage for description)

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

About

Dynamically load fonts in React Native! Elevate your UI with on-the-fly typography.

www.npmjs.com/package/react-native-fontify

Resources

Readme
License

Code of conduct

Code of conduct

Contributing

Contributing
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.