两个ScrollView 嵌套,导致的,外部scrollview 影响内部scrollview,求解决方案
-
问题
我们有一个一个容器,外部是一个列表页(scrollView1),列表上面是横向日历组件(scrollView2)。代码如下
<ScrollView scrollY style={scrollStyle} onScroll={this.onScroll()} scrollTop={this.props.scrollToTop} lowerThreshold={Threshold} upperThreshold={Threshold} onScrollToUpper={this.onScrollToUpper()} onScrollToLower={this.handleScrollToLower.bind(this)} > <ScrollView id='line-calendar__scroll' key="line-calendar__scroll-key" ref="line-calendar__scroll-ref" className='day-list' scrollX scrollWithAnimation scrollLeft={scrollLeft} > // TODO: something </ScrollView> // TODO: some list </ScrollView>
当 外部scrollview 滚动,内部scrollview 会render 导致 scrollLeft 的值会被重置
-