creativetimofficial/now-ui-react-native

[Bug] You started loading the font "montserrat-regular", but used it before it finished loading.

Closed this issue · 3 comments

Version

1.0.1

Reproduction link

https://github.com/creativetimofficial/now-ui-react-native#technical-support-or-questions

Operating System

ANDROID

Device

Redmi 4

Browser & Version

Expo

Steps to reproduce

clone the repository of free code
run npm install
run expo start

What is expected?

should run the app

What is actually happening?

getting error


Solution

Additional comments

You started loading the font "montserrat-regular", but used it before it finished loading.

  • You need to wait for Font.loadAsync to complete before using the font.

  • We recommend loading all fonts before rendering the app, and rendering only Expo.AppLoading while waiting for loading to complete.

Replace function componentDidMount. Fixed the problem
async componentDidMount() { await Font.loadAsync({ 'montserrat-regular': require('./assets/font/Montserrat-Regular.ttf'), 'montserrat-bold': require('./assets/font/Montserrat-Bold.ttf') } ); this.setState({fontLoaded: true, isLoadingComplete: true}); }

@webmailcontatos Thank you this solution is solved my problem I have to add await and also have to add isLoadingComplete: true otherwise my screen will stuck at loading screen even though it show me that loading complete.

This shouldn't be a problem anymore as this was solved by previous versions. Thank you for your interest in our products!