React-Native-ViewPager icon indicating copy to clipboard operation
React-Native-ViewPager copied to clipboard

undefined is not an object (evaluating curItemLayoutInfo.layout)

Open claudepark opened this issue 7 years ago • 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?

claudepark avatar Nov 17 '18 05:11 claudepark