Skip to content

NETI-MOBILE/react-native-text-weight

Repository files navigation

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

About

Fix fontWeight prop for React-native CLI and Expo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published