GetStream / react-native-bidirectional-infinite-scroll

📜 React Native - Bidirectional Infinite Smooth Scroll
https://getstream.github.io/react-native-bidirectional-infinite-scroll/
MIT License
236 stars 27 forks source link

Not able to mock this module for unit tests #20

Open apoorva-techie opened 3 years ago

apoorva-techie commented 3 years ago

Hi,

I need to mock this module to run unit tests successfully on my component. However m not able to use it in tests. On writing tests, it is throwing this error on Flatlist:

console.error Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check the render method of 'Component'.

I am importing Flatlist like this in my component:

import { FlatList } from 'react-native-bidirectional-infinite-scroll';

Could you please help with this? Would highly appreciate!

Package.json:

"react-native-bidirectional-infinite-scroll": "^0.3.3", "react": "16.9", "react-native": "0.61.5",

vishalnarkhede commented 3 years ago

Hey @apoorva-techie do you mind setting up example of this test within example directory, and sending a PR? Will be easier for me to deal with the issue