expo-google-fonts v0.0.0
expo-google-fonts
The @expo-google-fonts
packages for Expo allow you to easily use
any of 964 fonts (and their variants) from
fonts.google.com in your Expo app.
These packages and all these fonts work across web, iOS, and Android.
Usage
Here is an example of using the Nunito font family in a very simple project.
Install the package for the font you want
expo install @expo-google-fonts/nunito expo-font
In your app
import React, { useState, useEffect } from 'react';
import { Text, View, StyleSheet } from 'react-native';
import { AppLoading } from 'expo';
import {
Nunito_Regular400,
Nunito_SemiBold600_Italic,
useFonts,
} from '@expo-google-fonts/nunito';
export default () => {
let [fontsLoaded] = useFonts({
Nunito_Regular400,
Nunito_SemiBold600_Italic,
});
let fontSize = 24;
let paddingVrtical = 6;
if (!fontsLoaded) {
return <AppLoading />;
} else {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={{ fontSize, paddingVertical, fontFamily: 'Nunito_Regular400' }}>
Nunito_Regular400
</Text>
<Text style={{ fontSize, paddingVertical, fontFamily: 'Nunito_SemiBold600_Italic' }}>
Nunito_SemiBold600_Italic
</Text>
</View>
);
}
};
Example Project
Here is a minimal but complete example
Each individual font family package README includes a complete example of using that font family.
🔡 Available Fonts
You can browse all available Google Fonts on fonts.google.com.
Here are a few examples of the 964 font families available:
You can check out the gallery for this project to see all of them.
👩💻 @expo-google-fonts/dev
If you are trying out lots of different fonts, you can try using the @expo-google-fonts/dev
package.
You can import any font style from any Expo Google Fonts package from it. It will load the fonts over the network at runtime instead of adding the asset as a file to your project, so it may take longer for your app to get to interactivity at startup, but it is extremely convenient for playing around with any style that you want.
📖 Licensing
The Expo Google Fonts project and its code are licensed under the MIT License.
All the fonts in the Google Fonts catalog are free and open source.
Individual fonts have their own licenses. Many are licensed using the Open Font License. For example, Nunito uses the OFL. Check the Google Fonts pages of the font families you are using and add those licenses to your project's licenses list when you publish.
Q: Can I use these fonts commercially: to make a logo, in my app, on my website, etc.?
A: You can use these fonts freely in your products & projects - print or digital, commercial or otherwise. However, you can't sell the fonts on their own. This isn't legal advice, please consider consulting a lawyer and see the full license for all details.
🤝 Contributing
Contributions are very welcome! Note that everything under font-packages
and also this README are generated.
So, please make any changes you want to make to the generator instead of the packages themselves.
Authors
🔗 Links
4 years ago