Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ajaybhatia/react-native-font-global
React Native apply custom font for iOS and Android
https://github.com/ajaybhatia/react-native-font-global
font react-native react-native-font react-native-font-global react-native-fonts react-native-global-font react-native-library
Last synced: about 1 month ago
JSON representation
React Native apply custom font for iOS and Android
- Host: GitHub
- URL: https://github.com/ajaybhatia/react-native-font-global
- Owner: ajaybhatia
- Created: 2020-05-08T08:26:14.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-08T09:28:34.000Z (over 4 years ago)
- Last Synced: 2024-12-20T21:42:03.436Z (about 1 month ago)
- Topics: font, react-native, react-native-font, react-native-font-global, react-native-fonts, react-native-global-font, react-native-library
- Language: Java
- Size: 227 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-font-global
React Native apply custom font for iOS and Android
# Installation
- Add font file to your app **src/assets/fonts/**
- In **react-native.config.js** :
```
module.exports = {
...
project: {
ios: {},
android: {},
},
assets: ['./src/assets/fonts'],
...
};
```- Install package
using npm
```
npm install react-native-font-global
```using yarn
```
yarn add react-native-font-global
```- Link Fonts
```
react-native link
```- **iOS**
```
pod install
```- **Android** (Auto-linking)
# Usage
Go to your first component which wraps the whole application **(mostly App.js)**.
```
import applyFontGlobally from 'react-native-font-global';applyFontGlobally('YourCustomFontName');
```# Example App
Example app can be found in **example/** directory.
## How to use and run example
- Clone Repository
```
git clone https://github.com/ajaybhatia/react-native-font-global
```- Swtich to example directory
```
cd example
```- Install dependencies
```
npm install
```- Run example
**Android:**
```
react-native run-android
```**iOS:**
```
pod install
``````
react-native run-ios
```