Applying custom font on label does not work
See original GitHub issueAm I missing something? I’m trying to change the font family for my textfield labels.
Version
- tcomb-form-native v0.6.4
- react-native v0.41.2
Expected behaviour
Should be able to set custom fontFamily style on controlLabel
Actual behaviour
The font does not change for controlLabel. I can change it for textbox without problems.
Steps to reproduce
var t = require('tcomb-form-native')
// Label
t.form.Form.stylesheet.controlLabel.normal
.color = 'red' // This does apply!
t.form.Form.stylesheet.controlLabel.normal
.fontFamily = 'Oswald-Regular' // This does NOT apply!
// Textbox
t.form.Form.stylesheet.textbox.normal
.fontFamily = 'Oswald-Regular' // This does apply!
My form look like this:
const t = require('tcomb-form-native')
let Form = t.form.Form
let LoginFormModel = t.struct({
user: t.String
})
let LoginFormOptions = {
fields: {
user: {
label: 'Email address'
}
}
}
renderForm() {
return(
<Form ref='loginForm'
type={LoginFormModel}
value={this.state.formValue}
options={LoginFormOptions}
onChange={(value) => this.onFormChange(value)}
/>
)
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:8
Top Results From Across the Web
Unable to set custom font for the UILabel in XCode
Unable to set custom font for the UILabel in XCode · Open "app-info.plist" under "Supporting Files" folder · Add new row in the...
Read more >Custom Font not working - Microsoft Q&A
7 Answers · Go to Font Awesome website and download the font file . · Copy the file into shared project , notice...
Read more >Custom fonts in launch screen | Apple Developer Forums
I've set a background image which is working fine and a label which I've set the text as an Attributed String. The problem...
Read more >Custom Fonts Not Displaying On Front End - Elementor
Go to Elementor > Custom Fonts. If the URLs listed do not begin with https, click the DELETE button next to each, and...
Read more >Common Mistakes With Adding Custom Fonts to Your iOS App
This should not be a problem but sometimes when you're having trouble getting your font face to show up, this can be a...
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
In order to take the weight of the font itself. For example i am using Montserrat and this font have different types like Monteserrat-Regular or UltraLight, the way i managed it to make it work was to set the fontWeight to undefined
That is working for me. Firstly, you need to install custom font in your react native project.
const formStyles = { …Form.stylesheet, formGroup: { normal: { marginBottom: 10, }, }, controlLabel: { normal: { color: ‘#f88800’, fontSize: 18, marginBottom: 7, fontWeight: ‘600’, fontFamily: ‘Zawgyi-One’ }, // the style applied when a validation error occours error: { color: ‘red’, fontSize: 18, marginBottom: 7, fontWeight: ‘600’, fontFamily: ‘Zawgyi-One’ } } }