react-simple-pull-to-refresh icon indicating copy to clipboard operation
react-simple-pull-to-refresh copied to clipboard

fetchMoreTresholdBreached

Open javaxiu opened this issue 1 year ago • 0 comments

i think this should be a useRef ,

https://github.com/thmsgbrt/react-simple-pull-to-refresh/blob/b91b3eff46210b5c5e7e95d6b02a83e0d1a4eb45/src/components/pull-to-refresh.tsx?_pjax=%23js-repo-pjax-container%2C%20div%5Bitemtype%3D%22http%3A%2F%2Fschema.org%2FSoftwareSourceCode%22%5D%20main%2C%20%5Bdata-pjax-container%5D#L43

because when dragging is happening, something like loading state would change the children props, which will cause this FunctionComponent re-call, then, this fetchMoreTresholdBreached flag would be false again, in tihs situation, here

var onScroll = function (e) {
    /**
         * Check if component has already called onFetchMore
         */
    if (fetchMoreTresholdBreached) return;

it may not work as expected

javaxiu avatar Mar 10 '23 02:03 javaxiu