Coder Social home page Coder Social logo

thmsgbrt / react-simple-pull-to-refresh Goto Github PK

View Code? Open in Web Editor NEW
166.0 166.0 40.0 2.02 MB

npm install react-simple-pull-to-refresh

Home Page: https://www.npmjs.com/package/react-simple-pull-to-refresh

License: MIT License

HTML 3.92% CSS 4.97% TypeScript 52.10% JavaScript 34.11% SCSS 4.89%

react-simple-pull-to-refresh's Introduction

Hey! Nice to see you.

Welcome to my page!
I'm Thomas, Fullstack developer from Lorient, France, currently living in Stockholm, Sweden.

Things I code with

React Webpack Docker github actions Google Cloud Platform TypeScript Insomnia Apollo Heroku redux ReactiveX GraphQL Sass Styled Components git NestJs angular npm html5 Brave browser Rollup d3js Prettier MongoDB Nodejs

Open source projects

🎁 Projects ⭐ Stars 📚 Forks 🛎 Issues 📬 Pull requests
React PullToRefresh component Stars Forks Issues Pull Requests
Typescript & React Chrome Extension Starter Stars Forks Issues Pull Requests
NodeJs Express TypeScript GraphQL Starter Stars Forks Issues Pull Requests

My latest posts

Välkommen till Stockholm!

Above are the last 3 pictures posted by @visitstockholm!
Currently, the weather is: 15°C, clear sky
Today, the sun rises at 03:31 and sets at 22:03.

Where to find me

Github Twitter LinkedIn Medium


This README file is generated every 3 hours!
Last refresh: Thursday, 13 June, 20:01 CEST
Create your own here!

Stars Forks

react-simple-pull-to-refresh's People

Contributors

d-s-x avatar dependabot[bot] avatar felixmosh avatar hamandrock avatar joshuahiggins avatar manudoni avatar mjauernig avatar thmsgbrt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-simple-pull-to-refresh's Issues

fetchMoreTresholdBreached

i think this should be a useRef ,

let pullToRefreshThresholdBreached: boolean = false;

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

Custom color on the loading indicator

I am trying to apply custom styling so that the loading indicator stands out more on my dark background (honestly just trying to make it white). I am having trouble getting css to apply after trying the classNames and style attributes with no luck.

I would love to see this color configurable through a prop likebackgroundColor. The component is working as expected, aside from me not knowing how to set the color, thanks for the awesome work!

Bug Found !!

I found this this issue when i was working with dropdown in react , when i open the dropdown and select any option and move cursor any where down , it refresh the page .

onSrolll: null is not an object (evaluating 'P.current.classList')

The following line is throwing an error due to containerRef.current being null.

react-simple-pull-to-refresh/build/index.esm.js in onScroll at line 258:26

/**
 * Check if user breached fetchMoreThreshold
 */
    if (canFetchMore && getScrollToBottomValue() < fetchMoreThreshold && onFetchMore) {
            fetchMoreTresholdBreached = true;
            containerRef.current.classList.add('ptr--fetch-more-treshold-breached'); <---- This line is throwing the error
            onFetchMore().then(initContainer).catch(initContainer);
        }
    };

This can be triggered by the component getting unmounted during a scroll event.

Cannot read properties of undefined (reading 'then')

<PullToRefresh onRefresh={() => console.log('aaa')}>
	<ul>
		{list.map((item, index) => (
			<li key={index}>{item}</li>
		))}
	</ul>
</PullToRefresh>;

Version: "react-simple-pull-to-refresh": "^1.3.3",
React: "react": "^17.0.2"

Each time I scroll down I get the following error ("Uncaught TypeError: Cannot read properties of undefined (reading 'then') at HTMLDivElement.onEnd (index.esm.js:280:1)").

Perhaps I'm doing something wrong. Thanks!

How to stop loading behavior

I can't stop loading action, I think that the loadmore event should not be called when there is a load event in progress.

Whats this area at the bottom and how can I remove this ?

Prop I have passed

  canFetchMore={false}
  pullDownThreshold={120}
  maxPullDownDistance={150}
  pullingContent=""
  refreshingContent={loader animation component}
  onRefresh= function

help me fix this issue. I cannot find where this white space is coming from.

Capture

Enable event listeners like onScroll or add a callback for onPull

This is more of a feature request, but would love the ability to know if the user began the pull. I have a list of intractable items (both tap and long press events) and if the user begins pulling down it doesn't stop the event from propagating down, or rather up I guess, the touch down on my list element gets responded too before the pull to refresh can full complete resulting in it getting cancelled because my app changes state based on the item tapped.
Currently I'm bubbling those events up to the parent and having it handle it, and I'm forced to use the Ionic framework instead because it gives me an onPull event where I can see if the user was attempting a pull-to-refresh and then basically cancel the select event if you will on the underlying element.
But I like the lighter weight of yours, I just can't figure out a way to make it work with my clients designs. They very much want a UITableView like experience in a native iOS app essentially.

Bounce when flicked to the top

I noticed the pull to refresh only works if the element is already at the top of the page. I want it to activate even if I start halfway down the page and quickly scroll up. Is there a way to achieve this?

Animation doesnt deactivate

When I "Pull to Refresh" and no data comes in, the animation continues to load, even after isPullable becomes false. How I tell the component to stop the loading animation and pull back up?

Allow to load css from the project it self

First of all thank you for this awesome lib! 🙏🏼

Currently, the css is bundled with js, and injected at runtime with some magic injectStyles function.

In my project I want to process all the css with my custom loaders (postcss rtl, autoprefixer, etc), is it possible to allow importing the styles as a separate import, similar to what react-toastify allows (it's just adds the css file to the build folder)

undefined is not an object (evaluating 'f().then')

First of all thank you for this awesome library!

Been using this library but currently experiencing this error on-refresh seems to be a error tied to sentry, tried updating sentry dependencies but no luck.
image

image

The `window.scrollY` is a problems!

your code

const getScrollToBottomValue = (): number => {
   if (!childrenRef || !childrenRef.current) return -1;
   const scrollTop = window.scrollY; // is the pixels hidden in top due to the scroll. With no scroll its value is 0.
   const scrollHeight = childrenRef.current.scrollHeight; // is the pixels of the whole container
   return scrollHeight - scrollTop - window.innerHeight;
 };

The window.scrollY !It is limited to being used only in the window. If a scroll bar appears at a maximum height on its outer layer, it will not work

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.