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

Sugestion about hook #6

Open
gabrielbs opened this issue Sep 20, 2018 · 1 comment
Open

Sugestion about hook #6

gabrielbs opened this issue Sep 20, 2018 · 1 comment
Labels

Comments

@gabrielbs
Copy link

Did you think that is relevant a "onLayoutComplete" hook?

@danilowoz
Copy link
Contributor

danilowoz commented Sep 24, 2018

Hey @gabrielbs, great question

Actually, there is a way to catch onLayoutUpdated (but it still needs implementation), but it's not possible to know when the layout is completed (all updates are finished). Also, I'm thinking what is more interesting, to catch the onLayoutUpdated or onLayoutCompleted, because if you're using a third library into the react-snuggle, you should know every time the layout is updated and not only at the end of all updates (we don't know how many updates will exist in the layout).

When the layout will update?

  • componentDidMount: when the component is mounted;
  • Reposition items once after mounted: the layout needs a trigger to calculate its correct position;
  • onLoadImages : after each image is loaded, the layout will be updated. So the layout will update the same amount of time the number of images.

What can we do?

I think we can put a callback at the end setValues function. (https://github.com/Significa/react-snuggle/blob/master/src/index.js#L43). And I think we can improve the name of this function (updateLayout is better, or if you have another suggestion).

So, @gabrielbs if you want, feel free to open a PR with this changes and let me know your thought about this 🍺

@danilowoz danilowoz added good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed labels Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants