react-native-text-weight
TypeScript icon, indicating that this package has built-in type declarations

0.6.1 • Public • Published

Installing package

yarn add react-native-text-weight

React Native CLI (not Expo)

Edit android/app/build.gradle and add the following:

apply from: "../../node_modules/react-native-text-weight/fonts.gradle"

Usage

Insert the following code into the starting point of the application (usually App.js)

Expo

import FontManager from 'react-native-text-weight/expo';
 
const [loaded, setLoaded] = useState(false); // its necessary for font loading async and update ui
 
useEffect(() => {
    FontManager.init().then(() => setLoaded(true));
}, []);
 
return loaded ? (
    <Content />
) : (
    <ActivityIndicator />
);

React Native CLI

import FontManager from 'react-native-text-weight';
 
const [loaded, setLoaded] = useState(false); // its necessary for font loading async and update ui
 
useEffect(() => {
    FontManager.init().then(() => setLoaded(true));
}, []);
 
return loaded ? (
    <Content />
) : (
    <ActivityIndicator />
);

Issues

  • Custom fonts are not well-tested

Package Sidebar

Install

npm i react-native-text-weight

Weekly Downloads

5

Version

0.6.1

License

MIT

Unpacked Size

3.84 MB

Total Files

36

Last publish

Collaborators

  • aynurd
  • nabi.defacto