Expo無法載入字體
P粉805535434
P粉805535434 2024-04-05 15:18:52
0
1
3481

我一直在嘗試在Expo中載入字體,但我一直得到相同的錯誤。

這是我的程式碼:

我的Index.js如下圖:

import WelcomePage from "./Authentication/WelcomePage";

export default function Page() {

  return (
      <WelcomePage/>
  );
}

而我的Welcomepage看起來是這樣的:

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(
        <View style={{width: windowForm().at(0), height:windowForm().at(1)}}>
            <Text style={{fontFamily:'Inter_900Black'}}>
                Hey
            </Text>
        </View>
    )
}
export default WelcomePage

這是我一直得到的錯誤:

警告:React偵測到WelcomePage中Hooks呼叫的順序改變了。如果不修復,這將導致錯誤和bug。了解更多信息,請閱讀Hooks的規則:https://reactjs.org/link/rules-of-hooks

包括以下內容:

之前的渲染

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

下一個渲染

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

P粉805535434
P粉805535434

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!