Closed z3season closed 3 years ago
代码如下:
<FlingGestureHandler ref={this.upFlingRef} simultaneousHandlers={this.nativeGestureRef} direction={Directions.UP} onHandlerStateChange={({nativeEvent}: any) => {
}} > <FlingGestureHandler ref={this.downFlingRef} simultaneousHandlers={this.nativeGestureRef} direction={Directions.DOWN} onHandlerStateChange={({nativeEvent}: any) => { }} > <NativeViewGestureHandler shouldActivateOnStart disallowInterruption ref={this.nativeGestureRef} simultaneousHandlers={[this.upFlingRef, this.downFlingRef]} > <WaterfallList ref={ref => this.waterfallListRef = ref} style={{width: SCREEN_WIDTH, backgroundColor: listType === 4 ? '#f3f3f3' : '#fff'}} showsVerticalScrollIndicator={false} data={isEmptyArray(dataArray) ? [1] : dataArray} // onScroll={(e: any) => this.onScrollMethod(e)} // onContentSizeChange={({width, height}) => { // this.contentSizeHeight = height; // }} heightForItem={(item: any) => { if (isEmptyArray(dataArray)) { return EmptyHeight; } return item.height; }} numColumns={(listType === 4 ? 2 : 1)} renderItem={this.renderItemBind} renderHeader={() => this._subTradeContent(paddingTop)} // @ts-ignore loadingFooter={WaterfallLoadingFooter} allLoaded={!canLoadMore} onLoading={() => { this.currentPage += 1; this.loadGoodsListData(this.currentPage); }} renderFooter={() => <View style={{height: px2dp(30)}}/>} /> </NativeViewGestureHandler> </FlingGestureHandler> </FlingGestureHandler>
RN这个事件比你想象的复杂,安卓上这个问题目前来看解决不来。SpringScrollView在安卓上相当于是截获了触摸事件的。RN在原生不处理任何触摸事件,全都放到js层处理的。
代码如下:
<FlingGestureHandler ref={this.upFlingRef} simultaneousHandlers={this.nativeGestureRef} direction={Directions.UP} onHandlerStateChange={({nativeEvent}: any) => {