Giter Club home page Giter Club logo

Comments (7)

nandorojo avatar nandorojo commented on September 23, 2024 1

Looks like it was because it wasn't capitalized in the theme before. Glad it's working.

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

Can you show your expo font loader code?

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

I'm currently snowboarding so I'm going to send a screenshot lol.

Did you see this in the docs?

image

from dripsy.

zilahir avatar zilahir commented on September 23, 2024

Hey! Thanks for replying :) Marry Christmas!

Yes, I've seen that in the docs, and the reason I haven't shared the font loading method, because I could verify the fonts being loaded correctly:

fonts: {
    root: "Inter-Bold",
  },

So this, indicates that the Inter-Bold font loaded correctly, and the error message is gone, and the font is bold.

I have a custo wrapper to load async, you can check it here

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

It's hard for me to help without seeing a simple reproduction of the docs not working. Could you see if loading it in the way the docs say with expo font works?

One thing to keep in mind: when you load in the font with expo fonts, the name of the normal weight font should be inter. The name of the imported font is important.

from dripsy.

zilahir avatar zilahir commented on September 23, 2024

@nandorojo sorry for the late answer. I am loading the fonts as its described in the expo dosc, using Fonts.loadAsync.

This is the Object, that stores the fonts, and being passed to the loadAsync promise:

const fonts = {
  "Inter-Black": require("./assets/fonts/Inter/Inter-Black.ttf"),
  "Inter-Bold": require("./assets/fonts/Inter/Inter-Bold.ttf"),
  "Inter-ExtraBold": require("./assets/fonts/Inter/Inter-ExtraBold.ttf"),
  "Inter-ExtraLight": require("./assets/fonts/Inter/Inter-ExtraLight.ttf"),
  "Inter-Light": require("./assets/fonts/Inter/Inter-Light.ttf"),
  "Inter-Medium": require("./assets/fonts/Inter/Inter-Medium.ttf"),
  "Inter-Regaular": require("./assets/fonts/Inter/Inter-Regular.ttf"),
  "Inter-SemiBold": require("./assets/fonts/Inter/Inter-SemiBold.ttf"),
  "Inter-Thin": require("./assets/fonts/Inter/Inter-Thin.ttf"),
};

And then:

const useLoadAssets = (assets: number[], fonts: FontSouce): boolean => {
  const [ready, setReady] = useState(false);
  usePromiseAll(
    [Font.loadAsync(fonts), ...assets.map((asset) => Asset.loadAsync(asset))],
    () => setReady(true)
  );
  return ready;
};

So you say:

One thing to keep in mind: when you load in the font with expo fonts, the name of the normal weight font should be inter. The name of the imported font is important.

If i understand this correctly, the Inter-Regular in this object should be Inter as that will be the default font.

const fonts = {
  "Inter-Black": require("./assets/fonts/Inter/Inter-Black.ttf"),
  "Inter-Bold": require("./assets/fonts/Inter/Inter-Bold.ttf"),
  "Inter-ExtraBold": require("./assets/fonts/Inter/Inter-ExtraBold.ttf"),
  "Inter-ExtraLight": require("./assets/fonts/Inter/Inter-ExtraLight.ttf"),
  "Inter-Light": require("./assets/fonts/Inter/Inter-Light.ttf"),
  "Inter-Medium": require("./assets/fonts/Inter/Inter-Medium.ttf"),
  Inter: require("./assets/fonts/Inter/Inter-Regular.ttf"), // HERE
  "Inter-SemiBold": require("./assets/fonts/Inter/Inter-SemiBold.ttf"),
  "Inter-Thin": require("./assets/fonts/Inter/Inter-Thin.ttf"),
};

And then, in the theme:

    Inter: {
      bold: "Inter-Bold",
      default: "Inter-Regular",
      normal: "Inter",
      "400": "Inter-Regular",
      "300": "Inter-Thin",
      "500": "Inter-Medium",
      "600": "Inter-Medium",
      "700": "Inter-SemiBold",
    },
  },
  fonts: {
    root: "Inter",
  },

from dripsy.

zilahir avatar zilahir commented on September 23, 2024

UPDATE:

Hah! It seems like it's working this way! :)

Thank you!

from dripsy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.