Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UseFonts throws an error in Mac BigSur #38

Open
poustchi opened this issue Jul 6, 2021 · 3 comments
Open

UseFonts throws an error in Mac BigSur #38

poustchi opened this issue Jul 6, 2021 · 3 comments

Comments

@poustchi
Copy link

poustchi commented Jul 6, 2021

UseFonts throws the following error on BigSur but its ok on Catalina

FontStatus: [Error: Unexpected status line: Y�] false


import * as React from "react";
import { View, Text, StyleSheet } from "react-native";
import AppLoading from "expo-app-loading";

import {
  useFonts,
  Roboto_100Thin,
  Roboto_100Thin_Italic,
  Roboto_300Light,
  Roboto_300Light_Italic,
  Roboto_400Regular,
  Roboto_400Regular_Italic,
  Roboto_500Medium,
  Roboto_500Medium_Italic,
  Roboto_700Bold,
  Roboto_700Bold_Italic,
  Roboto_900Black,
  Roboto_900Black_Italic,
} from "@expo-google-fonts/roboto";

export default function App() {
  let [loaded, error] = useFonts({
    Roboto_100Thin,
    Roboto_100Thin_Italic,
    Roboto_300Light,
    Roboto_300Light_Italic,
    Roboto_400Regular,
    Roboto_400Regular_Italic,
    Roboto_500Medium,
    Roboto_500Medium_Italic,
    Roboto_700Bold,
    Roboto_700Bold_Italic,
    Roboto_900Black,
    Roboto_900Black_Italic,
  });

  if (!loaded) {
    return <AppLoading />;
  }

  console.log("FontStatus:", error, loaded);

  return (
    <View>

      <Text style={{ fontFamily: "Roboto_100Thin", fontSize: 30 }}>
        ABCDEFGHIabcdefghi
      </Text>
      
    </View>
  );
}

@guess-burger
Copy link

I've run into a similar issue. However, I'm not using expo-google-fonts and instead I've had the issues with local assets I'm loading via expo-fonts.
I've even just create a new app using the " tabs (TypeScript) - several example screens and tabs using react-navigation and TypeScript" template which includes space-mono. However, running the app gives me

Unexpected status line: 0+%#'77'7''73''77b`�3X

                                              X3�`�3X

                                                     X3P�3X2-4-2X3��3X2-��-2X3
at node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:103:50 in promiseMethodWrapper
at node_modules/@unimodules/react-native-adapter/build/NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.name
at node_modules/expo-file-system/build/FileSystem.js:105:17 in downloadAsync
at node_modules/expo-file-system/build/FileSystem.js:101:7 in downloadAsync
at node_modules/expo-asset/build/PlatformUtils.js:49:25 in _downloadAsyncManagedEnv

fontFamily "space-mono" is not a system font and has not been loaded through Font.loadAsync.

I'm using a M1 Macbook running Big Sur. Again, this issue seem to be with expo-font which expo-google-fonts calls.

@JordaoViktor
Copy link

Same issue here, someone fixed?

@herbertfuchs
Copy link

herbertfuchs commented Jun 1, 2022

UseFonts throws the following error on BigSur but its ok on Catalina

FontStatus: [Error: Unexpected status line: Y�] false


import * as React from "react";
import { View, Text, StyleSheet } from "react-native";
import AppLoading from "expo-app-loading";

import {
  useFonts,
  Roboto_100Thin,
  Roboto_100Thin_Italic,
  Roboto_300Light,
  Roboto_300Light_Italic,
  Roboto_400Regular,
  Roboto_400Regular_Italic,
  Roboto_500Medium,
  Roboto_500Medium_Italic,
  Roboto_700Bold,
  Roboto_700Bold_Italic,
  Roboto_900Black,
  Roboto_900Black_Italic,
} from "@expo-google-fonts/roboto";

export default function App() {
  let [loaded] = useFonts({
    Roboto_100Thin,
    Roboto_100Thin_Italic,
    Roboto_300Light,
    Roboto_300Light_Italic,
    Roboto_400Regular,
    Roboto_400Regular_Italic,
    Roboto_500Medium,
    Roboto_500Medium_Italic,
    Roboto_700Bold,
    Roboto_700Bold_Italic,
    Roboto_900Black,
    Roboto_900Black_Italic,
  });

  if (!loaded) {
    return <AppLoading />;
  }

  console.log("FontStatus:", loaded);

  return (
    <View>

      <Text style={{ fontFamily: "Roboto_100Thin", fontSize: 30 }}>
        ABCDEFGHIabcdefghi
      </Text>
      
    </View>
  );
}

have you tried to remove the error variable from useFonts() method? Idk if that was your intention but maybe isn't the right way to catch an error, just loaded can handle the thing for ya, returning boolean values!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants