Font not passing to components
See original GitHub issueI have tried following the docs and a bunch of posts, but I cannot get my fonts to format any react-native-paper components. I follow the expo example of how to load fonts using loadFontAsync()
, and when I pass these fonts to my own components using the style prop fontFamily: 'Rubik-Regular'
the font works so I know it is not an issue of the font not existing.
I am using expo
39.0.3, react-native
0.63.3, react-native-paper
4.2.0, and react-native-vector-icons
7.1.0.
Any ideas on how to go about making this font work would be greatly appreciated.
import React from 'react';
import { Provider as ReduxProvider } from 'react-redux'
import configureStore from './store'
import { configureFonts, DefaultTheme, Provider as PaperProvider } from 'react-native-paper'
import { AppLoading } from 'expo';
import * as Font from 'expo-font';
import AppNavigator from './components/AppNavigator'
const store = configureStore();
const fontConfig = {
default: {
regular: {
fontFamily: 'Rubik-Regular',
fontWeight: 'normal',
},
medium: {
fontFamily: 'Rubik-Black',
fontWeight: 'normal',
},
light: {
fontFamily: 'Rubik-Light',
fontWeight: 'normal',
},
thin: {
fontFamily: 'Rubik-LightItalic',
fontWeight: 'normal',
},
},
};
const myTheme = {
dark: false,
roundness: 30,
fonts: configureFonts(fontConfig),
colors: {
...DefaultTheme.colors,
primary: '#0d80d6',
accent: '#E68FAE',
background: '#C6E1F2',
},
animation: {
scale: 1.0,
},
}
export default class App extends React.Component {
render() {
return (
<ReduxProvider store={store}>
<PaperProvider theme={myTheme}>
<AppNavigator />
</PaperProvider>
</ReduxProvider>
);
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
React-Native-Paper Theme won't use Custom Fonts
I am working on a RN app using react-native-paper to handle theming and UI. I have the theme working to format my components,...
Read more >How to Build a Title Component and Import Multiple Fonts
Welcome back to the course. In this video, we are going to style our application here, so let's look at our design real...
Read more >API Reference - styled-components
A function that receives the props that are passed into the component and computes a value, that is then going to be merged...
Read more >Text Style Props - React Native
Specifies font weight. The values 'normal' and 'bold' are supported for most fonts. Not all fonts have a variant for each of the...
Read more >Font-face and Styled Components - clairecodes
You may already have them, or you can use a tool like google-webfonts-helper to download the font files for Google web fonts. It...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As an intermediate solution, we are happy to merge a PR to our documentation that explains how this function work. Would be awesome if you could submit such a PR 🙏
This is my config.