React-native-paper: Custom fonts, configureFonts function

Created on 4 Dec 2019  路  6Comments  路  Source: callstack/react-native-paper

You need to specify the ios key of the object needed by the function configureFonts. Just putting a default in there is not enough if you want your font to display on the ios simulator. Not sure if intended or not :)

{
ios: {
  // needs to be specified
},
 default: {
    regular: {
      fontFamily: 'Lato',
      fontWeight: 'normal',
    },
    medium: {
      fontFamily: 'Lato-Bold',
      fontWeight: 'bold',
    },
    light: {
      fontFamily: 'Lato-Light',
      fontWeight: 'normal',
    },
    thin: {
      fontFamily: 'Lato-Thin',
      fontWeight: 'normal',
    },
  }
}
Stale

Most helpful comment

Thanks man that helped me!

const fontConfig = {
  default: {
    regular: {
      fontFamily: 'raleway-regular',
      fontWeight: 'normal',
    },
    medium: {
      fontFamily: 'raleway-medium',
      fontWeight: 'normal',
    },
    light: {
      fontFamily: 'raleway-light',
      fontWeight: 'normal',
    },
    thin: {
      fontFamily: 'raleway-thin',
      fontWeight: 'normal',
    },
  },
};

fontConfig.ios = fontConfig.default;
fontConfig.android = fontConfig.default;

All 6 comments

Thanks man that helped me!

const fontConfig = {
  default: {
    regular: {
      fontFamily: 'raleway-regular',
      fontWeight: 'normal',
    },
    medium: {
      fontFamily: 'raleway-medium',
      fontWeight: 'normal',
    },
    light: {
      fontFamily: 'raleway-light',
      fontWeight: 'normal',
    },
    thin: {
      fontFamily: 'raleway-thin',
      fontWeight: 'normal',
    },
  },
};

fontConfig.ios = fontConfig.default;
fontConfig.android = fontConfig.default;

Thank you @kopax

@kopax - Works Thanks - Just note if using for WEB
fontConfig.web = fontConfig.default;

Hello 馃憢, this issue has been open for more than 2 months with no activity on it. If the issue is still present in the latest version, please leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution on workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix the issue.

where, we need to add this fontConfig?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ButuzGOL picture ButuzGOL  路  3Comments

talaikis picture talaikis  路  3Comments

ZhengYuTay picture ZhengYuTay  路  3Comments

yaronlevi picture yaronlevi  路  3Comments

ButuzGOL picture ButuzGOL  路  4Comments