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

Visibility: onOnScreen doesn't fire if element is onScreen on first render #2324

Closed
boostup opened this issue Nov 16, 2017 · 2 comments
Closed
Labels

Comments

@boostup
Copy link

boostup commented Nov 16, 2017

Hello Guys!

I'm basically trying to show a react element that is onScreen on first render. So, I found Visibility: onOnScreen doesn't fire if element is onScreen on first render, which lead me to this page.

1)According to the comment on there on Sep 11, a fix was released at version 0.73.0
I have version 0.76.0 in my project. However, when wrapping it with a Visibility react tag, an element, say an image, does not show until I scroll, even though the image is already partially onScreen.

Here is a codesandbox to show this issue.

2)Also, if I include the fireOnMount prop on the Visibility tag, then calculations.onScreen is always equal to true. Is that normal? I can't understand the reason for this...What is fireOnMount for? I don't get it from the docs https://semantic-ui.com/behaviors/visibility or https://react.semantic-ui.com/behaviors/visibility

Thanks for any assistance on these 2 points

@layershifter
Copy link
Member

  1. You need to set fireOnMount, see forked codepen as Visibity doesn't fire events on component mount by default.

  2. Yes, it's on normal. onScreen represents position of an element, if it's true that means that element is visible on the screen. See forked codepen and scroll down, once element will not visible, onScreen will become false.

@boostup
Copy link
Author

boostup commented Nov 28, 2017

Hi layershifter!

I was finally able to resume my work on this and just checked the forked pens.
Thanks for taking the time: it did help me out!

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

No branches or pull requests

2 participants