Could not resolve font for undefined, fontWeight 400 in react-pdf

Viewed 803

I had a problem when importing font, it return an error: Unhandled Rejection (Error): Could not resolve font for undefined, fontWeight 400.

import OpenSanSrc from 'assets/font/OpenSans-Regular.ttf';
Font.register({
 family: 'Open Sans',
 src: OpenSanSrc,
})

and apply for the page style like this:

const styles = StyleSheet.create({
  page: {
    paddingVertical: 45,
    paddingHorizontal: 35,
    backgroundColor: '#E4E4E4',
    fontFamily: 'Open Sans'
  },
}

Does anyone have idea about this? Any help would be appreciated

0 Answers
Related