diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/App.native.tsx | 5 | ||||
-rw-r--r-- | src/App.web.tsx | 5 | ||||
-rw-r--r-- | src/alf/fonts.ts | 19 |
3 files changed, 14 insertions, 15 deletions
diff --git a/src/App.native.tsx b/src/App.native.tsx index b780880b3..2ec666e2c 100644 --- a/src/App.native.tsx +++ b/src/App.native.tsx @@ -55,7 +55,7 @@ import {TestCtrls} from '#/view/com/testing/TestCtrls' import {Provider as VideoVolumeProvider} from '#/view/com/util/post-embeds/VideoVolumeContext' import * as Toast from '#/view/com/util/Toast' import {Shell} from '#/view/shell' -import {ThemeProvider as Alf, useFonts} from '#/alf' +import {ThemeProvider as Alf} from '#/alf' import {useColorModeTheme} from '#/alf/util/useColorModeTheme' import {NuxDialogs} from '#/components/dialogs/nuxs' import {useStarterPackEntry} from '#/components/hooks/useStarterPackEntry' @@ -156,13 +156,12 @@ function InnerApp() { function App() { const [isReady, setReady] = useState(false) - const [loaded] = useFonts() React.useEffect(() => { initPersistedState().then(() => setReady(true)) }, []) - if (!isReady || !loaded) { + if (!isReady) { return null } diff --git a/src/App.web.tsx b/src/App.web.tsx index 075ce964a..fa5f1de93 100644 --- a/src/App.web.tsx +++ b/src/App.web.tsx @@ -46,7 +46,7 @@ import {Provider as VideoVolumeProvider} from '#/view/com/util/post-embeds/Video import * as Toast from '#/view/com/util/Toast' import {ToastContainer} from '#/view/com/util/Toast.web' import {Shell} from '#/view/shell/index' -import {ThemeProvider as Alf, useFonts} from '#/alf' +import {ThemeProvider as Alf} from '#/alf' import {useColorModeTheme} from '#/alf/util/useColorModeTheme' import {NuxDialogs} from '#/components/dialogs/nuxs' import {useStarterPackEntry} from '#/components/hooks/useStarterPackEntry' @@ -146,13 +146,12 @@ function InnerApp() { function App() { const [isReady, setReady] = useState(false) - const [loaded, error] = useFonts() React.useEffect(() => { initPersistedState().then(() => setReady(true)) }, []) - if (!isReady || (!loaded && !error)) { + if (!isReady) { return null } diff --git a/src/alf/fonts.ts b/src/alf/fonts.ts index 264e51fa8..7f6bde5fa 100644 --- a/src/alf/fonts.ts +++ b/src/alf/fonts.ts @@ -1,6 +1,6 @@ import {useFonts as defaultUseFonts} from 'expo-font' -import {isNative, isWeb} from '#/platform/detection' +import {isWeb} from '#/platform/detection' import {Device, device} from '#/storage' const FAMILIES = `-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Liberation Sans", Helvetica, Arial, sans-serif` @@ -35,15 +35,16 @@ export function setFontFamily(fontFamily: Device['fontFamily']) { } /* - * Unused fonts are commented out, but the files are there if we need them. + * IMPORTANT: This is unused. Expo statically extracts these fonts, but we load + * them manually so that we can parallelize the loading along with the JS + * bundle. + * + * See `#/alf/util/useFonts` for the actually used hooks. + * + * All used fonts MUST be configured here. Unused fonts are commented out, but + * the files are there if we need them. */ -export function useFonts() { - /** - * 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 (isNative) return [true, null] +export function DO_NOT_USE() { return defaultUseFonts({ // 'Inter-Thin': require('../../assets/fonts/inter/Inter-Thin.otf'), // 'Inter-ThinItalic': require('../../assets/fonts/inter/Inter-ThinItalic.otf'), |