React native 更新属性时出错';X';在类型为:RCTView的阴影节点中

React native 更新属性时出错';X';在类型为:RCTView的阴影节点中,react-native,React Native,我有一个从道具值接收值的项目。 根据react本机错误消息,未正确设置此值 export default class BarItem extends Component { constructor (props) { super(props); } propTypes : { color: PropTypes.string, barInterval: PropTypes.number, }; const {color, barInterval} = this.

我有一个从道具值接收值的项目。 根据react本机错误消息,未正确设置此值

export default class BarItem extends Component {

constructor (props) {
    super(props);
}

propTypes : {
    color: PropTypes.string,
    barInterval: PropTypes.number,
};
    const {color, barInterval} = this.props;

render () {
    const baseStyle = {
        backgroundColor: color,
        marginRight: barInterval
    };

    return ( <View style={Object.assign({}, baseStyle, {height: (empty * unitHeight)}) } /> );
  }
}
导出默认类BarItem扩展组件{
建造师(道具){
超级(道具);
}
道具类型:{
颜色:PropTypes.string,
barInterval:PropTypes.number,
};
const{color,barInterval}=this.props;
渲染(){
常量baseStyle={
背景颜色:颜色,
marginRight:barInterval
};
返回();
}
}
我想知道为什么我不能更新我的值,阴影节点是什么,以及将来如何防止这种情况


编辑:“barinterval”的值是字符串,但只接受数字。(给出的值是否错误?

错误说明它希望变量为整数,而不是字符串值

示例

是错误的,但
是正确的


在这种情况下,值
marginRight
需要一个整数才能工作,因为变量在样式表中使用。

什么是
baseStyle
?你能展示一下吗?与
baseStyle
无关,谢谢你和我一起思考。你的返回中的方括号(
]
)是用来做什么的?很明显,整个style属性应该在一个数组示例中:'style={[Object.assign({},baseStyle,{height:[empty*unitHeight]}没有引号。因为它添加了多种样式。没有线索,如果这仍然是这样做,现在一天,但与反应本机V0.27这是情况。节省了我的几个小时。我希望我能投更多的票