-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Feat/precompile fonts #3003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Feat/precompile fonts #3003
Changes from 6 commits
07c018e
f7aca3f
104c144
f25a59a
0320212
5bbf8dd
2acb4c1
17ffdf2
a5ae257
5c97a05
2c98262
d75e7a1
13561b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,6 @@ | |
| }, | ||
| "plugins": [ | ||
| "expo-localization", | ||
| "expo-font", | ||
| [ | ||
| "expo-splash-screen", | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,30 +2,64 @@ | |
| // markdown file and add links from here | ||
|
|
||
| import { Platform } from "react-native" | ||
| import { | ||
| SpaceGrotesk_300Light as spaceGroteskLight, | ||
| SpaceGrotesk_400Regular as spaceGroteskRegular, | ||
| SpaceGrotesk_500Medium as spaceGroteskMedium, | ||
| SpaceGrotesk_600SemiBold as spaceGroteskSemiBold, | ||
| SpaceGrotesk_700Bold as spaceGroteskBold, | ||
| } from "@expo-google-fonts/space-grotesk" | ||
| import { FontSource, useFonts } from "expo-font" | ||
|
|
||
| export const customFontsToLoad = { | ||
| spaceGroteskLight, | ||
| spaceGroteskRegular, | ||
| spaceGroteskMedium, | ||
| spaceGroteskSemiBold, | ||
| spaceGroteskBold, | ||
| export const FONT_FILES: Record<string, string> = { | ||
| SpaceGrotesk_300Light: require("../../assets/fonts/SpaceGrotesk-300Light.ttf"), | ||
| SpaceGrotesk_400Regular: require("../../assets/fonts/SpaceGrotesk-400Regular.ttf"), | ||
| SpaceGrotesk_500Medium: require("../../assets/fonts/SpaceGrotesk-500Medium.ttf"), | ||
| SpaceGrotesk_600SemiBold: require("../../assets/fonts/SpaceGrotesk-600SemiBold.ttf"), | ||
| SpaceGrotesk_700Bold: require("../../assets/fonts/SpaceGrotesk-700Bold.ttf"), | ||
| } | ||
|
|
||
| export const customFontsToLoad = FONT_FILES as Record<string, FontSource> | ||
|
||
|
|
||
| /** | ||
| * On iOS and Android, the fonts are embedded as part of the app binary | ||
| * using the expo config plugin in `app.json`. See the project | ||
| * [`app.json`](../../app.json) for the expo-fonts configuration. The assets | ||
ChristopherGabba marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * are added via the `app/assets/fonts` folder. This config plugin | ||
| * does NOT work for web, so we have to dynamically load the fonts via this hook. | ||
| * | ||
| * For more info: https://docs.expo.dev/versions/latest/sdk/font/ | ||
| */ | ||
| export const useCustomFonts = (): [boolean, Error | null] => { | ||
| if (Platform.OS === "web") { | ||
| // eslint-disable-next-line react-hooks/rules-of-hooks | ||
|
||
| return useFonts(customFontsToLoad) | ||
| } | ||
|
|
||
| // On native, fonts are precompiled and ready | ||
| return [true, null] | ||
| } | ||
|
|
||
| const fonts = { | ||
| spaceGrotesk: { | ||
| // Cross-platform Google font. | ||
| light: "spaceGroteskLight", | ||
| normal: "spaceGroteskRegular", | ||
| medium: "spaceGroteskMedium", | ||
| semiBold: "spaceGroteskSemiBold", | ||
| bold: "spaceGroteskBold", | ||
| light: Platform.select({ | ||
| ios: "SpaceGrotesk-Light", | ||
| android: "SpaceGrotesk-300Light", | ||
| web: "SpaceGrotesk_300Light", | ||
| }), | ||
| normal: Platform.select({ | ||
| ios: "SpaceGrotesk-Regular", | ||
| android: "SpaceGrotesk-400Regular", | ||
| web: "SpaceGrotesk_400Regular", | ||
| }), | ||
| medium: Platform.select({ | ||
| ios: "SpaceGrotesk-Medium", | ||
| android: "SpaceGrotesk-500Medium", | ||
| web: "SpaceGrotesk_500Medium", | ||
| }), | ||
| semiBold: Platform.select({ | ||
| ios: "SpaceGrotesk-SemiBold", | ||
| android: "SpaceGrotesk-600SemiBold", | ||
| web: "SpaceGrotesk_600SemiBold", | ||
| }), | ||
| bold: Platform.select({ | ||
| ios: "SpaceGrotesk-Bold", | ||
| android: "SpaceGrotesk-700Bold", | ||
| web: "SpaceGrotesk_700Bold", | ||
| }), | ||
| }, | ||
| helveticaNeue: { | ||
| // iOS only font. | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||
| { | ||||||
| "name": "ignite-cli", | ||||||
| "version": "11.2.0", | ||||||
| "version": "11.2.1", | ||||||
|
||||||
| "version": "11.2.0", |
suggestion: no need for this, I think CI will do it for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: let's undo this change before merge, please.
Uh oh!
There was an error while loading. Please reload this page.