is not a system font and has not been loaded through font.loadasync code example
Example 1: when using native base toast has error fontFamily "Roboto_medium" is not a system font and has not been loaded through Font.loadAsync.
was able to solve the issue by adding this to your Font.loadasync
Roboto: require("native-base/Fonts/Roboto.ttf"),
Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf"),
________________________________________________________________________
import { Ionicons } from '@expo/vector-icons';
import * as Font from 'expo-font';
import * as SplashScreen from 'expo-splash-screen';
import * as React from 'react';
export default function useCachedResources() {
const [isLoadingComplete, setLoadingComplete] = React.useState(false);
// Load any resources or data that we need prior to rendering the app
React.useEffect(() => {
async function loadResourcesAndDataAsync() {
try {
SplashScreen.preventAutoHideAsync();
// Load fonts
await Font.loadAsync({
...Ionicons.font,
'space-mono': require('../assets/fonts/SpaceMono-Regular.ttf'),
Roboto: require("native-base/Fonts/Roboto.ttf"),
Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf"),
});
} catch (e) {
// We might want to provide this error information to an error reporting service
console.warn(e);
} finally {
setLoadingComplete(true);
SplashScreen.hideAsync();
}
}
loadResourcesAndDataAsync();
}, []);
return isLoadingComplete;
}
Example 2: fontfamily "octicons" is not a system font and has not been loaded through font.loadasync.
fontfamily "octicons" is not a system font and has not been loaded through font.loadasync.
The fix for the above error would in 3 steps as following:
1. Delete node_modules folder from the root directory.
2. Delete package-lock.json file from the root directory of react-native project.
3. Run npm install from project directory.