0.6.1 • Published 4 years ago
react-native-text-weight v0.6.1
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