Reputation: 743
I have custom fonts working in my project using React Native's in-built support for cross-platform custom fonts. I'm curious if there is anyway to apply fontFamily
to the ToolbarAndroid component (https://facebook.github.io/react-native/docs/toolbarandroid.html ). Unfortunately, the toolbar style
does not support the key.
I also attempted setting title to a component myTitle
and feeding it to the toolbars title
attribute, but this results in a cyclic error:
var myTitle = <Text style={{fontFamily: 'MyFont'}}>My Profile</Text>
Ideally, I would love to keep the native toolbar rather than replace it with a custom JS toolbar that supports custom fonts.
Upvotes: 2
Views: 141
Reputation: 743
Fixed by placing the mytitle
component, using custom fontFamily
, within the ToolbarAndroid tags like so:
<ToolbarAndroid>{mytitle}</ToolbarAndroid>
Rather than trying to place the component within the title
attribute of ToolbarAndroid.
Upvotes: 4