React-native-paper: Document how to use custom fonts

Created on 15 May 2018  路  4Comments  路  Source: callstack/react-native-paper

We should provide/link to instructions for using a custom font since it's a lot more work than just changing the font family in theme.

good first task

Most helpful comment

It wasn't much work to switch to the Roboto fonts for my current app. Follow the process here: https://medium.com/@moschan/easiest-way-to-load-your-custom-fonts-in-react-native-d091fb380204

Steps 1-4 setup the project, then I configured the provider like so:

const theme = {
  ...DefaultTheme,
  fonts: {
    regular: 'Roboto',
    medium: 'Roboto',
    light: 'Roboto Light',
    thin: 'Roboto Thin',
  },
}

class Root extends PureComponent<Props, State> {
  static defaultProps = {}

  render () {   
    return (
      <PaperProvider theme={theme}>
        <MyAppEntryPoint />
      </PaperProvider>
    )
  }
}

All 4 comments

@satya164 Is there really a way to do it? I'm trying to change <TextInput /> font, but with no success yet.

It wasn't much work to switch to the Roboto fonts for my current app. Follow the process here: https://medium.com/@moschan/easiest-way-to-load-your-custom-fonts-in-react-native-d091fb380204

Steps 1-4 setup the project, then I configured the provider like so:

const theme = {
  ...DefaultTheme,
  fonts: {
    regular: 'Roboto',
    medium: 'Roboto',
    light: 'Roboto Light',
    thin: 'Roboto Thin',
  },
}

class Root extends PureComponent<Props, State> {
  static defaultProps = {}

  render () {   
    return (
      <PaperProvider theme={theme}>
        <MyAppEntryPoint />
      </PaperProvider>
    )
  }
}

Hi, where we should add this documentation?

@Taym95 I think a new page under "guides" section will be good

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tonyxiao picture tonyxiao  路  3Comments

sritharanpalani picture sritharanpalani  路  4Comments

mihaidaviddev picture mihaidaviddev  路  3Comments

alikazemkhanloo picture alikazemkhanloo  路  4Comments

ButuzGOL picture ButuzGOL  路  4Comments