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

Track_visibility does not work on mac safari browser #58

Open
thienthu1221 opened this issue Nov 15, 2019 · 2 comments
Open

Track_visibility does not work on mac safari browser #58

thienthu1221 opened this issue Nov 15, 2019 · 2 comments

Comments

@thienthu1221
Copy link

I check the props through console.log (props.isVisible)
and it only returns true when there is a scroll event. Also on the screen when reloading the website is always false

@ddanielcruzz
Copy link

I had a similar problem, what I did was to execute a scrolling for the <TrackVisibility> to work. If you are having the problem on the initial render you can do the following:

Class based component

componentDidMount(){
  window.scroll(0,1);
  window.scroll(0,-1);
}

Functional component

React.useEffect(() => {
  window.scroll(0,1);
  window.scroll(0,-1);
}, [])

@wiliamvj
Copy link

I had the same problem, on mobile browsers it didn't load either, I added once and offset={ } and everything worked perfectly.

<TrackVisibility
  once
  offset={400}
>
</TrackVisibility>

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