以下是我的反应组件的一部分.我有一个名为daysUntil的道具进入这个包含数字的组件.在这个例子中,它正在传递数字0,这导致fontWeight函数返回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;
  } 
 我收到以下错误:
JSON value ‘700’ of type NSNumber cannot be converted to Nsstring.
我假设这是因为font-weight期望值为字符串格式.对此有什么正确的解决方法?
先感谢您!
解决方法
 在你的fontWeight()函数中 
  
  
 
        return weight * 100;
也许变成:
var val= weight * 100; return val.toString();