H1 doesn't render fontFamily on Android
See original GitHub issue👋🏽
Hello! I’m implementing a simple header in my app and it seems like Android is not rendering the font properly
iOS

Android

import { H1, Theme } from 'dripsy'
import theme from './theme'
// simplified example
const App = () => (
<DripsyProvider theme={theme}>
<H1>Hello world</H1>
</DripsyProvider>
)
import { Theme } from 'dripsy'
const makeTheme = <T extends Theme>(t: T): T => t
const theme = makeTheme({
fonts: {
root: 'nunito',
},
customFonts: {
nunito: {
bold: 'nunitoBold',
default: 'nunito',
normal: 'nunito',
400: 'nunito',
500: 'nunitoSemiBold',
600: 'nunitoBold',
700: 'nunitoBold',
800: 'nunitoExtraBold',
900: 'nunitoBlack',
},
},
text: {
default: {
fontSize: 18,
color: 'text',
},
h1: {
fontSize: [24, 32],
color: 'text',
},
},
})
export default theme
I’ve noticed if I commented this line out in @expo/html-elements, it starts to work:
https://github.com/expo/expo/blob/master/packages/html-elements/src/elements/Headings.tsx#L39
I’ve tried debugging the code in my node modules but still can’t figure it out. It’s weird that it works perfectly fine in iOS, but not in Android 🤔
Any help is appreciated!
In the meantime, my workaround is
<H1 as={Text} >Hello world</H1>
and it’s still able to pull variant “text.h1” 👍🏽
Thank you!!
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
H1, H2, H3, H4 Tags aren't rendering custom .ttf fonts in Android.
When specifying a custom True Type Font in tagStyles for h1, h2, h3 and/or h4, the font is not applied to the node...
Read more >Custom font not working in React Native - Stack Overflow
In case somebody is reading this because their setup is fine and custom fonts work on iOS and in some cases don't work...
Read more >Custom fonts not loading on mobile - Site Design & Styles
Hello, I uploaded a custom font and it's working fine on desktop but won't load on mobile. I've tested on both android and...
Read more >font-family - CSS: Cascading Style Sheets - MDN Web Docs
The font-family CSS property specifies a prioritized list of one or more font family names and/or generic family names for the selected ...
Read more >CSS @font-face in Browser and WebView does not work on ...
you must make sure the font on your android use default. because android get first font from local.
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 Free
Top 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

For now, I recommend making your own
H1, …etc text components, like so:I’ll work on a better internal solution that supports Android soon. However, we should open an issue at
@expo/html-elements, since that’s where the bug lies.Yeah, that’s because you set it to bold for h1 in your theme. You could indeed do that.