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

How detect offset? #141

Open
eseQ opened this issue Nov 27, 2019 · 3 comments
Open

How detect offset? #141

eseQ opened this issue Nov 27, 2019 · 3 comments

Comments

@eseQ
Copy link

eseQ commented Nov 27, 2019

Hello.
I use react-measure to detect dimensions and offset changes in my case.
Main idea: Have a visible list and list of hidden items;
But I have no way to track offset changes.
I created demo: https://codesandbox.io/s/modest-list-omkl0
I have a list like this: before
And if add some element: after
No one after the new element does not touch onResize callback. Yeah, dimensions stay without changes but bounds (offsets) have been changed.
Any ideas?

@souporserious
Copy link
Owner

Weird! I'm not sure why it's not calling onResize properly 🤔 Everything looks fine in your code. I noticed you are using hooks. You might have better luck with something like use-measure library. I'm hoping to release a hooks version soon that might help here. I'll dig deeper when I get some time. Thanks for filing an issue and putting together a code sample! 🙏

@eseQ
Copy link
Author

eseQ commented Nov 28, 2019

@souporserious thanks for the answer. Use measure-hook it`s a clever idea. Let`s test it!
https://codesandbox.io/s/modest-list-56t7e
Good news - now we know about the change position.
But we have strange behavior - equivalents x values for all items. And the right value obviously.

demo

@eseQ
Copy link
Author

eseQ commented Nov 28, 2019

@cvpcasada can you help me? Maybe I use use-measure wrong?

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

2 participants