Skip to content

How do I use a custom font family for the Typography component? #8

Answered by hiriski
hey6 asked this question in Q&A
Discussion options

You must be logged in to vote

To use a custom font family you can create your own theme configuration that extends from the default theme, you can also use different font types for each variant

import { UnistylesRegistry } from 'react-native-unistyles'
import { theme_lightTheme, theme_breakpoints, ThemeBreakpoints, Themes, Theme } from '@kujang/uniui'

declare module 'react-native-unistyles' {
  export interface UnistylesBreakpoints extends ThemeBreakpoints {}
  export interface UnistylesThemes extends Themes {}
}

export const myTheme: Theme = {
  ...theme_lightTheme,
  typography: {
    body: {
      fontFamily: 'Jost',
    },
    caption: {
      fontFamily: 'Roboto',
    },
  },
}

UnistylesRegistry.addBreakpoints(t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hey6
Comment options

Answer selected by hey6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants