79620510

Date: 2025-05-13 22:48:03
Score: 0.5
Natty:
Report link

in my case, I was using Tamagui with the expo and based on @AquaSidiscool 's answer, I just needed to add a face config for my font in the Tamagui config

here is my code:

(Be careful that you should add all of the options in the face config object especially "bold" and "normal")

export const tamaguiConfig = createTamagui({
    ...defaultConfig,
    themes,
    fonts: {
        ...defaultConfig.fonts,
        body: {
            family: 'MyCustomFont',
            size: {
                0: 10,
                1: 12,
                2: 14,
                3: 15,
                4: 16,
                5: 17,
                6: 18,
                7: 20,
                8: 24,
            },
            lineHeight: {
                1: 17,
                2: 22,
                3: 25,
            },
            weight: {
                1: '100',
                3: '300',
                4: '400',
                6: '600',
            },
            letterSpacing: {
                4: 0,
                8: -1,
            },

            // for native only, alternate family based on weight/style
            face: {
                // pass in weights as keys
                normal: { normal: 'MyCustomFontBold' },
                bold: { normal: 'MyCustomFontBold' },
                300: { normal: 'MyCustomFont' },
                500: { normal: 'MyCustomFontMedium' },
                700: { normal: 'MyCustomFontBold' },
            },
        }
    }
})

export default tamaguiConfig

export type Conf = typeof tamaguiConfig

declare module 'tamagui' {
    interface TamaguiCustomConfig extends Conf {
    }
}
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @AquaSidiscool
  • Low reputation (1):
Posted by: mojtaba farhadi