question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fontFamily 'Roboto_medium' is not a system font and has not been loaded through Exponent.Font.loadAsync.

See original GitHub issue

My environment:

  "dependencies": {
    "@expo/vector-icons": "^5.0.0",
    "expo": "^18.0.4",
    "link": "^0.1.5",
    "native-base": "^2.2.0",
    "react": "16.0.0-alpha.12",
    "react-native": "https://github.com/expo/react-native/archive/sdk-18.0.1.tar.gz",
    "react-native-vector-icons": "^4.2.0",
    "react-navigation": "^1.0.0-beta.11"
  }

I take a reference from official sample it just like:

import React from 'react';
import { Container, Header, Button, Text, Icon, Left, Right, Title, Body } from 'native-base';

export default class App extends React.Component {

  render() {
    return (
              <Container>
        <Header>
          <Left>
            <Button transparent>
              <Icon name='menu' />
            </Button>
          </Left>
          <Body>
            <Title>I am Title Man</Title>
          </Body>
          <Right />
        </Header>
        <Button>
          <Text>
            Button
          </Text>
        </Button>
      </Container>
    );
  }
}

It compiles well on my IOS emulator , but when i try it on Android emulator , it shows the error:

fontFamily ‘Roboto_medium’ is not a system font and has not been loaded through Exponent.Font.loadAsync.

  • If you intended to use a system font, make sure you typed the name correctly and that it is supported by your device operating system.

  • If this is a custom font, be sure to load it with Exponent.Font.loadAsync.

fontFamily ‘Roboto_medium’ is not a system font and has not been loaded through Exponent.Font.loadAsync.

  • If you intended to use a system font, make sure you typed the name correctly and that it is supported by your device operating system.

  • If this is a custom font, be sure to load it with Exponent.Font.loadAsync.

I try to find some solutions , it likes: 1.close running packager 2.run react-native link react-native-vector-icons 3.and run react-native start --reset-cache 4.Finally use react-native run-ios

It still can’t solve the issue , how can i fix it ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

27reactions
shivrajkumarcommented, Jul 13, 2017

@motogod With expo you need to load custom fonts. Something like this

11reactions
motogodcommented, Jan 18, 2018

Hi,

Its been a long time i don’t use React Native any more.

Hope this code can help you.

Key point is the constructor and componentWillMount function

import React from ‘react’; import Expo from ‘expo’; import { StyleSheet, Text, View, StatusBar } from ‘react-native’; import { Container, Drawer, Header, Body, Left, Right, Button, Icon, Title, Footer, FooterTab, Content, Badge } from ‘native-base’;

import DrawerView from ‘./screens/DrawerView’;

export default class App extends React.Component { constructor() { super(); this.state = { isReady: false }; }

async componentWillMount() { await Expo.Font.loadAsync({ Roboto: require(“native-base/Fonts/Roboto.ttf”), Roboto_medium: require(“native-base/Fonts/Roboto_medium.ttf”), Ionicons: require(“@expo/vector-icons/fonts/Ionicons.ttf”) }); this.setState({ isReady: true }); }

closeDrawer = () => { console.log(‘closeDrawer click’); this.drawer._root.close() }; openDrawer = () => { console.log(‘openDrawer click’); this.drawer._root.open() };

//<View style={{ backgroundColor: ‘#227700’, height: 1000 }} /> render() { if (!this.state.isReady) { return <Expo.AppLoading />; }

return ( <Drawer ref={(ref) => { this.drawer = ref; }} content={<DrawerView />} backgroundColor= ‘#33FFAA’ onClose={() => this.closeDrawer()} >

<Container> <Header> <StatusBar backgroundColor="#008844" /> <Left> <Button transparent onPress={() => this.openDrawer()}> <Icon name='menu' /> </Button> </Left> <Body> <Title>Header</Title> </Body> <Right /> </Header> <Content> <Text> This is Content Section </Text> </Content> <Footer> <FooterTab> <Button full> <Text>Footer</Text> </Button> </FooterTab> </Footer> </Container> </Drawer>

); } }

2018-01-17 18:05 GMT+08:00 githubmss notifications@github.com:

i am facing the same issue , @shivrajkumar https://github.com/shivrajkumar and @motogod https://github.com/motogod can you please tell me what i need to do , do i have toput roboto-medium font file inside my folder and have to import that by using Expo.Font.loadAsync method ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GeekyAnts/NativeBase/issues/1041#issuecomment-358256532, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ9TY6jwmTRiD5AwRh1y9fozeMh4zE98ks5tLcYEgaJpZM4OWhc6 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

console.error: "fontFamily "Roboto_medium" is not a system ...
error: "fontFamily "Roboto_medium" is not a system font and has not been loaded through Font.loadAsync. - If you intended to use a system...
Read more >
Font - Expo Documentation
expo-font allows loading fonts from the web and using them in React Native components. See more detailed usage information in the Fonts guide....
Read more >
Fontfamily "Material Design Icons" Is Not A System Font And ...
Fontfamily "Material Design Icons" Is Not A System Font And Has Not Been Loaded Through Font.Loadasync. This error occurs when trying to import...
Read more >
Add Custom Font to React Native using Expo - WebOmnizz
fontFamily “roboto-medium” is not a system font and has not been loaded through Font.loadAsync. And this is because the app view renders ...
Read more >
Native Base UI Components: Solve issue with Roboto font on ...
fontFamily 'Roboto_medium' is not a system font and has not been loaded through Exponent.Font.loadAsync. Hello everyone. Today's story is about an error ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found