Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enableScrollSpy wrong behaviour #676

Open
Mbensler opened this issue Jun 22, 2022 · 6 comments
Open

enableScrollSpy wrong behaviour #676

Mbensler opened this issue Jun 22, 2022 · 6 comments

Comments

@Mbensler
Copy link

When using enableScrollSpy my countup instantly goes to 0 when i start scrolling even just an inch. It does not start moving again when leaving and entering the view.

I have used the provided examples in the README.

Expected behaviour:

  • I want it to start counting from 0 every time it enters the viewport.
@mmarkelov
Copy link
Collaborator

@Mbensler could you please provide a small representation, if it's possible?

@enix79
Copy link

enix79 commented Jun 29, 2022

+1, same here.

Interesting, in this codesandbox it works: https://codesandbox.io/s/bold-mopsa-nn8dkm

I made a gif to show the behaviour in my app: https://gifyu.com/image/SKp0N

@jlarteagap
Copy link

jlarteagap commented Jul 11, 2022

for me enableScrollSpy={true} goes to 0 when i start scrolling. But it's different, just with enableScrollSpy

@mmarkelov
Copy link
Collaborator

I'm not quite sure, but it can be related to countup library, cause react-countup did nothing about this scroll spy, so could someone try to check it with countup?

@hamzapaskingakhtar1999
Copy link

I'm not sure what's wrong since it works fine on Sandbox. Is it possible that since it is a component. Once the page renders. It also activates it? Rather than waiting for the viewpoint to reach it?

@hamzapaskingakhtar1999
Copy link

Found a solution to this from someone on StackOverflow.

import VisibilitySensor from 'react-visibility-sensor'; /* Install this dependency */

<CountUp end={100} redraw={true}> {({ countUpRef, start }) => ( <VisibilitySensor onChange={start} delayedCall> <span ref={countUpRef} /> </VisibilitySensor> )} </CountUp>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants