Below is part of my react component. I have a props named daysUntil coming into this component which contains a number. In this example it is being pass the number 0 which results in the fontWeight function returning 700
render: function() {
return (
<Text style={this.style()}>
{this.props.day}
</Text>
)
},
style: function() {
return {
fontWeight: this.fontWeight()
}
},
fontWeight: function() {
var weight = 7 - this.props.daysUntil;
return weight * 100;
}
I get the following error:
JSON value '700' of type NSNumber cannot be converted to NSSTring.
I'm assuming this is because font-weight expects the value to be in string format. What's the proper fix for this?
Thank you in advance!
In your fontWeight() function
return weight * 100;
maybe becomes:
var val= weight * 100;
return val.toString();