GithubHelp home page GithubHelp logo

Comments (9)

nandorojo avatar nandorojo commented on June 10, 2024 1

yeah, see the bottom of the dripsy instructions for Web. you should use link to load fonts in on web, just like any website.

from solito.

danieloi avatar danieloi commented on June 10, 2024 1

This might help

expo/google-fonts#5 (comment)

useFonts can actually work on the web 🎉

from solito.

nandorojo avatar nandorojo commented on June 10, 2024

your next config isn’t a proper array. withFonts should go before withExpo’s array.

from solito.

rodbs avatar rodbs commented on June 10, 2024

Like this ? why? I'm getting the same error:

module.exports = withPlugins(
  [withTM, [withFonts , [withExpo, { projectRoot: __dirname }]]],
  nextConfig
)

In the doc says :

const { withExpo } = require('@expo/next-adapter');
const withFonts = require('next-fonts');

module.exports = withExpo(
  withFonts({
    projectRoot: __dirname,
  })
);

from solito.

nandorojo avatar nandorojo commented on June 10, 2024

No, the first one is still wrong.

module.exports = withPlugins(
  [withTM, withFonts, withImages, [withExpo, { projectRoot: __dirname }]],
  {
    // ...
  }
)

from solito.

rodbs avatar rodbs commented on June 10, 2024

Ok, thanks. I've seen it's here! :)
https://solito.dev/install

But it's still not working for me because the useFonts functions seems to be not loading. I'm getting a blank page

export function Fonts({ children }) {
  const [loaded] = useFonts({
    dripsy: require('app/assets/fonts/Inter/Inter-Regular.ttf'),
    dripsyBold: require('app/assets/fonts/Inter/Inter-Bold.ttf'),
  })

  return <>{loaded && children}</>
}

export function Dripsy({ children }: { children: React.ReactNode }) {
  const colorMode = useColorScheme()

  return (
    <Fonts>
      <DripsyProvider
        theme={colorMode === 'dark' ? theme : themeLight}
        // this disables SSR, since react-native-web doesn't have support for it (yet)
        ssr
      >
        {children}
      </DripsyProvider>
    </Fonts>
  )
}

Is it supposed that any folder behind packages/app is shared between nextJS and expo? I've tried to place the files under / public ... in nextJs but it's not working either

from solito.

nandorojo avatar nandorojo commented on June 10, 2024

useFonts is only meant to run on the native app, are you using it on Web?

from solito.

rodbs avatar rodbs commented on June 10, 2024

yeap, i'm trying to use for web (nextJS) (using the same code for both native and web)
Should I split the code and load it on web in other way? which way do you recommend?

from solito.

nandorojo avatar nandorojo commented on June 10, 2024

Hey guys, I added a full example for using custom fonts with Solito here.

npx create-solito-app@latest my-solito-app -t with-custom-font

from solito.

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.