How does React Native (Expo) set the default font (or global font)?

how does React Native (Expo) set the default font (or global font)?
if you customize a Text component, it may be loaded asynchronously, as follows:

  componentWillMount = async () => {
    await Font.loadAsync({
      "a: require("../fonts/aaa.ttf"),
      "b": require("../fonts/bbb.ttf")
    });
    this.setState({ fontLoaded: true });
  };

then the following error may occur:

Warning: Can"t call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.

this error message is because you execute setState in componentWillMount
you can change it to componentDidMount

.
Menu