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

onChange is not triggered when required component reaches viewport #172

Open
cullsin opened this issue Jan 20, 2020 · 2 comments
Open

onChange is not triggered when required component reaches viewport #172

cullsin opened this issue Jan 20, 2020 · 2 comments

Comments

@cullsin
Copy link

cullsin commented Jan 20, 2020

Hi,

I have a home page with few components. When I reach component 'x' , I need to trigger a state. It is not working. But onChange event triggered when initialize, but not on scroll. Please suggest what I am missing.

  <VizSensor
    scrollCheck
    key={index}
    onChange={(isVisible) => {
      this.setState({
        isButton: true
      });
    }}
  >
  <ComponentTest
    key={index}
    heading={item.heading}
    description={item.description}
    pros={homePageTranslations.subscriptionFeatures.pros}
    boxes={homePageTranslations.subscriptionFeatures.boxes}
    language={this.props.i18n.language}
    t={this.props.t}
  />
  </VizSensor>

`

@GaddMaster
Copy link

I would start with putting that function in a variable and pass the variable in!
For me, your function is just calling straight away

@joshwnj
Copy link
Owner

joshwnj commented Jan 29, 2020

@cullsin I'm not sure I understand correctly... Could you please create an example like this, that shows the bug you're describing? https://codesandbox.io/s/p73kyx9zpm

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

3 participants