search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

1 answers
Q&A Expo cannot load fonts
Expo cannot load fonts
P粉805535434 2024-04-05 15:18:52 Views 4601

0

I've been trying to load fonts in Expo, but I keep getting the same error.

This is my code:

My Index.js looks like this:

import WelcomePage from "./Authentication/WelcomePage";

export default function Page() {

  return (
      
  );
}

And my Welcomepage looks like this:

import {Link, useRouter} from "expo-router";
import {windowForm} from "../Design/WindowForm";
import {Button} from "react-native-paper";
import Styles from "../Design/styles";
import Constants from "expo-constants";
import {Inter_900Black, useFonts} from "@expo-google-fonts/inter";

const WelcomePage = () => {
    const router = useRouter()
    let [fontsLoaded] = useFonts({
        Inter_900Black,
    });

    if (!fontsLoaded) {
        return null;
    }
    return(
        
            
                Hey
            
        
    )
}
export default WelcomePage

This is the error I keep getting:

Warning: React has detected that the order of Hooks calls in WelcomePage has changed. If not fixed, this will lead to errors and bugs. For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks

Includes the following:

Previous rendering

  1. useState
  2. useState
  3. useEffect
  4. undefined

Next rendering

  1. useState
  2. useState
  3. useEffect
  4. useState
Your Answer
submit

1 answers
0

Thanks to Mike 'Pomax' Kamermans

I've figured out I should do an MCVE first. This way I realized that the problem was not with the font, but with my javascript windowForm().at(0) being called in the same const.

I'm not sure why yet, but when I separate them, there are no errors. I'll edit this post once I know more. Hats off to Mike.

2024-04-06 13:26:19

submit

Popular tool

vc9-vc14 (32+64 bit) runtime library collection (link below)

vc9-vc14 (32+64 bit) runtime library collection (link below)

Download the collection of runtime libraries required for phpStudy installation

VC9 32-bit

VC9 32-bit

VC9 32-bit phpstudy integrated installation environment runtime library

PHP programmer toolbox full version

PHP programmer toolbox full version

Programmer Toolbox v1.0 PHP Integrated Environment

VC11 32-bit

VC11 32-bit

VC11 32-bit phpstudy integrated installation environment runtime library

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use