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

Double call onEndReached/onStartReached function #14

Open reeq-dev opened 3 years ago

reeq-dev commented 3 years ago

Hi. Thanks for such library, but i faced two issues. Ill create another "issue" to separate them later. So the first as title says: every time i have double call for both end reached functions. I have tried some blockers like "isLoading" with useState or useRef, and anyway i've got a double call.

onEndReached={() => fetchNextEvents('someParams')}
onStartReached={() => fetchPrevEvents('someParams')}
onEndReached={fetchNextEvents}
onStartReached={fetchPrevEvents}

const fetchPrevEvents = async (someParams = 'DEFAULT_PARAM') => {
    try {
        const events = await fetchEvents(someParams);
        ...
    } catch (err) {
      console.log('Error fetching prev events', err);
    }
};

IOS simulator - iPhone 11 - 14.4

"react-native": "0.64.0", "react-native-bidirectional-infinite-scroll": "^0.3.3", "@stream-io/flat-list-mvcp": "^0.10.1", "react": "17.0.1",

reeq-dev commented 3 years ago

Well, after some work around, the issue is dissapearing after setting prop bounces={false}