undefined is not an object (evaluating curItemLayoutInfo.layout)
claudepark opened this issue · 0 comments
I got an error that message is 'undefined is not an object (evaluating curItemLayoutInfo.layout)'
_visibleDetect() method in PagerTtileIndicator
const { width, x: curItemOffsetX } = curItemLayoutInfo.layout;
I called asynchronous api and I got datas using title of PagerTitleIndicator prop.
and I called this.viewPager.setPage(initIdx) but it occurs above error.
So, I think it is asynchronous issue.
I hacked this issue.
state = {
trackScoll : false
}
<PagerTitleIndicator
...other props,
titles={this.state.asyncTitleDatas}
trackScroll={this.state.trackScroll}
/>
componentDidUpdate(prevProps, prevState) {
if (prevState !== this.states) {
var initPosition = this._findInitPosition(data);
this.viewPager.setPage(initPosition )
this.setState({trackScroll:true})
}
}
is it other solution?