From 67cca6da02fb17b8b6df07f9f85396b0e25f6c26 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 18 Sep 2024 17:53:49 -0500 Subject: [PATCH] Fix for web --- src/alf/fonts.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/alf/fonts.ts b/src/alf/fonts.ts index 3ff2bdb6ef..ce658fa05b 100644 --- a/src/alf/fonts.ts +++ b/src/alf/fonts.ts @@ -1,7 +1,6 @@ import {useFonts as defaultUseFonts} from 'expo-font' -import {isWeb} from '#/platform/detection' -import {IS_PROD} from '#/env' +import {isNative, isWeb} from '#/platform/detection' import {Device, device} from '#/storage' const FAMILIES = `-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Liberation Sans", Helvetica, Arial, sans-serif` @@ -40,11 +39,11 @@ export function setFontFamily(fontFamily: Device['fontFamily']) { */ export function useFonts() { /** - * Local native builds work fine with `expo-font` config plugin, but web does - * not. So in dev, we ensure things are loaded using the async hook. In - * production, fonts load via the config plugin on all platforms. + * For native, the `expo-font` config plugin embeds the fonts in the + * application binary. But `expo-font` isn't supported on web, so we fall + * back to async loading here. */ - if (IS_PROD) return [true, null] + if (isNative) return [true, null] return defaultUseFonts({ // 'Inter-Thin': require('../../assets/fonts/inter/Inter-Thin.otf'), // 'Inter-ThinItalic': require('../../assets/fonts/inter/Inter-ThinItalic.otf'),