【发布时间】:2017-10-16 15:37:20
【问题描述】:
我对 react native 的度量有疑问:
checkPositionComponant = (id) => {
this.refs.component.measure((a, b, width, height, pageX, pageY) => {
tabTag[id].positionY = pageY;
});
}
componentTag() {
return tabTag.map((item, id) => {
return(
<View key={id} style={styles.componentView} ref="component">
{ this.checkPositionComponant(id) }
</View>
);
});
}
我的错误是:TypeError: Cannot read property 'measure' of undefined
【问题讨论】:
-
这意味着
this.refs.component是未定义的 -
是否正在渲染?
-
正在渲染是什么意思? componentTag 在我的渲染方法中被调用,就像
{ this.componentTag() }
标签: javascript reactjs react-native native