bolan9999 / react-native-largelist

The best large list component for React Native.
https://bolan9999.github.io/react-native-largelist/
MIT License
2.32k stars 261 forks source link

renderIndexPath的section, row会发生一次意外的刷新 #469

Open dxiya8948 opened 2 years ago

dxiya8948 commented 2 years ago

当使用this.LargeList.scrollTo({ x: 0, y: ofset, })跳转到列表某处时,renderIndexPath接收的({ section, row })会先跳到目标位置,此时数据是正常的,但很快会再次刷新导致旧数据出现(如下面的视频)

Dev OS (Mac)
Target OS (Android)
Simulator or real device? (Real Device)

react-native: 0.64.2, 
react-native-spring-scrollview: ^3.0.1-rc.5,
react-native-largelist: ^3.1.0-rc.2
renderIndexPath = ({ section, row }) => {
    const { countriesLargeListData } = this.state;
    const item = countriesLargeListData[section].items[row];

    return this.renderItem(item);
  }

render() {
  return (
  ...
    <FlexColContainer
        width="0"
        height="match_parent"
        flexGrow="1"
      >
        <LargeList
          ref={(ref) => { this.LargeList = ref; }}
          updateTimeInterval={10000}
          renderSection={this.renderSection}
          renderIndexPath={this.renderIndexPath}
          refreshHeader={ActivityIndicator}
          renderFooter={this.renderFooter}
          data={countriesLargeListData || []}
          heightForSection={() => SectionHeight}
          heightForIndexPath={() => IndexHeight}
          renderHeader={showHeader ? this.renderHeader : () => null}
        />
      </FlexColContainer>
  ...
    );
}

https://user-images.githubusercontent.com/43582652/146136585-0d2891b5-4182-4917-b48f-cf2a61054d7d.mp4

dxiya8948 commented 2 years ago

使用this.LargeList.scrollTo({ x: 0, y: ofset, }, false)或者this.LargeList.scrollToIndexPath({ section: key }, false)取消动画效果就没有这个问题~

这暂时解决了我的问题,但是最好还是希望有动画!

ghost commented 1 year ago

@dxiya8948 how can set you customs height in larglist renderIndexPath={this.renderIndexPath}

my problem

when I hide data ,data space also hide but it's not working in my code how can I soul this

I want like this

more details here

if you have any idea let me know