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

Cannot read property 'contentOffset' of undefined #462

Open hellofarhan opened 3 years ago

hellofarhan commented 3 years ago

If I try to run your example code got the following errors.

1. Cannot read property 'contentOffset' of undefined 2. TypeError: Cannot read property 'sumHeight' of undefined

return (
    <SpringScrollView>
      <WaterfallList
        data={data}
        ref={waterfaller}
        initialContentOffset={{ x: 0, y: 0 }}
        heightForItem={item => 180}
        preferColumnWidth={120}
        renderItem={renderCell}
        renderHeader={renderHeader}
        renderFooter={renderFooter}
        onRefresh={() => {
          setTimeout(() => waterfaller.current.endRefresh(), 2000);
        }}
        onLoading={() => {
          setTimeout(() => waterfaller.current.endLoading(), 2000);
        }}
      />
    </SpringScrollView>
  );

InkedScreenshot_1635961544

hellofarhan commented 3 years ago

When I was using yarn add react-native-spring-scrollview it installed the version "react-native-spring-scrollview": "^4.0.0-dev-0" by default. This is conflicting with "react-native-largelist": "^3.1.0-rc.2".

So if I use "react-native-spring-scrollview": "^3.0.1-rc.5" error Cannot read property 'contentOffset' of undefined has gone. I think there is a compatibility issue with these plugins. Better update the examples with latest react-native-spring-scrollview.