Created
July 28, 2021 02:39
-
-
Save emmaodia/3809d0fd3e7d07ffb86b9a4fdf8cd84c to your computer and use it in GitHub Desktop.
Using Google Fonts in Expo React Native
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import { AppLoading } from 'expo' | |
import AppLoading from 'expo-app-loading'; | |
import React, { useState } from 'react'; | |
import * as eva from '@eva-design/eva'; | |
import * as Font from 'expo-font' | |
import { ApplicationProvider } from '@ui-kitten/compon | |
import { default as mapping } from './mapping.json'; | |
const loadFonts = () => { | |
return Font.loadAsync({ | |
'space-mono': require('./assets/fonts/SpaceMono-Regular.ttf'), | |
}) | |
} | |
export default function App() { | |
const [fontsLoaded, setFontsLoaded] = useState(false) | |
if (!fontsLoaded) { | |
return ( | |
<AppLoading | |
startAsync={loadFonts} | |
onFinish={() => setFontsLoaded(true)} | |
onError={console.warn} | |
/> | |
); | |
} | |
return ( | |
<ApplicationProvider {...eva} theme={{ ...eva.dark, ...theme }} customMapping={mapping}> | |
... | |
</ApplicationProvider> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment