gameboyVito / react-native-ultimate-listview

A high performance FlatList providing customised pull-to-refresh | auto-pagination & infinite-scrolling | gridview layout | swipeable-row.
https://www.npmjs.com/package/react-native-ultimate-listview
MIT License
540 stars 87 forks source link

super expression must either be null or function #73

Open ninjia0 opened 1 year ago

ninjia0 commented 1 year ago

react: 18.2.0, react-native": "0.71.6, not working at all

billxie1988 commented 1 year ago

same isuue super expression must either be null or function

billxie1988 commented 1 year ago

subClass: [Function RefreshableScrollView] superClass: {"$$typeof": Symbol(react.forward_ref), "Context": {"$$typeof": Symbol(react.context), "Consumer": {"$$typeof": Symbol(react.context), "_calculateChangedBits": null, "_context": [Circular]}, "Provider": {"$$typeof": Symbol(react.provider), "_context": [Circular]}, "_calculateChangedBits": null, "_currentRenderer": {}, "_currentRenderer2": null, "_currentValue": null, "_currentValue2": null, "_threadCount": 0}, "displayName": "ScrollView", "render": [Function Wrapper]}

billxie1988 commented 1 year ago

I just try to fix it with this replace export default class RefreshableScrollView extends ScrollView with export default class RefreshableScrollView extends Component

The short answer is: ScrollView component is not supported to be extended via inheritance in react-leaflet library. In fact even React official documentation encourages to prefer composition over inheritance:

At Facebook, we use React in thousands of components, and we haven’t found any use cases where we would recommend creating component inheritance hierarchies.

Props and composition give you all the flexibility you need to customize a component’s look and behavior in an explicit and safe way. Remember that components may accept arbitrary props, including primitive values, React elements, or functions.