-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there any way to change header's font ? #542
Comments
That's how it should work. Are you sure you don't override |
yes. there is not other options that override it. color and other styles, everything works but fontFamily. |
Make sure you're using a supported Here's a list of supported fonts: https://github.com/dabit3/react-native-fonts static navigationOptions = {
header: ({ navigate }) => {
return {
titleStyle: {
fontFamily: 'American Typewriter'
},
};
},
}; |
Since the title passes and the end component is |
I have also faced this problem. The main problem seems to be in react-native rather than react-navigation. HeaderTitle.js sets fontWeight as fontWeight: Platform.OS === 'ios' ? '600' : '500', When fontWeight is set to >=500, react-native expects bold variation of custom font (naming convention CustomFont_bold.ttf) to be present. If it fails find bold variation of custom font, it falls back to default font family instead of custom font family with regular font. In this case, app is setting fontFamily to custom font and HeaderTitle.js is hardcoding fontWeight to 500, so custom font will never reflect. I'm planning to raise PR in react-native project to fix it by falling back to regular variation of custom font instead default family bold font. But if you feel, HeaderTitle.js should always read fontWeight from header.titleStyle. Let me know, happy to raise a PR. |
Just to note, Exponent does not support fontWeight or fontStyle at the moment, so those of us with custom fonts are SOL at the moment unless we go in and change the src. |
@thotegowda Heyy!!! thanks for that quick fix, that really helped me. |
|
Just because I landed here through a google search on how to change a headers font in general, and none of the above was working: Use |
@thotegowda any further information on this? did you have a chance to submit a PR? |
@aroth Renaming the font to |
If your fontFamily doesn't on Android for "headerTitleStyle" or "labelStyle", check weights managed by your font. Just discover after some research that Android use a default font, if requested font doesn't have the requested fontWeight. (iOS seems to ignore fontWeight in this case.) My workaround is to define a font weight present in my TTF file in "headerTitleStyle" and "labelStyle".
Hope this could help someone. |
In Jan 2018,
})` |
In feb 2018 :) Not worked for me, but, solved( for me ): -It is important, that 'fontFamily' contain name of font file( w/o extention ) In my case, name of font file: 'EuclidFlex-Regular.otf' |
That's well explained in this article. |
Hi guys, I am looking for a way to make the title text bold when the tab is active! Any ideas, thanx
|
@Charlynux Thank you for the hint. I was wondering why the font is working in other components, but not working in |
for One Plus 5t I got it working with |
⬆️ See above @mlazari answer ⬆️ This portion of code wasn't working. ❌
When I added {
color: 'white',
fontFamily: 'Montserrat-Bold',
fontSize: 16,
+ fontWeight: undefined,
}
It looks like a bug, or at least a weird font behaviour. |
Wow! That so weird... fontWeight: undefined works like a charm! Thank you @pascaloliv @Charlynux and @mlazari! |
it's really working but really and surprised also that why font weight is required. |
@Kalpeshsuthar I guess it's what @thotegowda said above. |
Thanks man, you helped me |
@thotegowda Thanks , you saved me. :) |
Cool!! Big thankssss!! |
Is there a way to change it for all headers once. Using the theme for instance? The documentation is really poor in this regard. |
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
Is there any way to change header's font ?
i tried this but didn't work.
The text was updated successfully, but these errors were encountered: