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

Rewrite visibility sensor to hooks #161

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

sergio-toro
Copy link

@sergio-toro sergio-toro commented Jul 11, 2019

This PR:

  • Fixes findDOMNode deprecation warning Fix findDOMNode deprecation warning #160
  • Adds a new API hook useVisibilitySensor hook for more powerful integrations.
  • Updates example to show new hook API.
  • Update required React version to 16.8.x.
  • Requires major release because has breaking changes.

Missing:

  • Update and fix tests with act calls if gets approved.

@joshwnj What do you think? It will be more powerful API than adding a custom way of passing ref up from VisibilitySensor.

sergio-toro and others added 11 commits July 29, 2019 11:54
This PR fixes React `findDOMNode` deprecation warning.
https://reactjs.org/docs/strict-mode.html#warning-about-deprecated-finddomnode-usage

This makes sure the component is compatible with upcoming concurrent mode.

It's a breaking change and requires a major release because it adds a node to the DOM, we could use `display: contents;` as suggested by React.
- added getRef so consumers can specify which element is used for calculations
  - necessary for absolutely positioned elements in a container
- added deprecation notice for passing elements as children
- added some new test cases
- updated README and examples
@jedwards1211
Copy link
Contributor

https://github.com/roderickhsiao/react-in-viewport already has a hook-based API. Maybe just add a link to it in docs?

@ghost
Copy link

ghost commented Jan 24, 2020

Anyone know where this ended up? I was looking at this PR and the other one linking to and it seems like they're both sitting on the back burner. Would love to get rid of those deprecation warnings... :)

@sergio-toro
Copy link
Author

sergio-toro commented Jan 25, 2020

Hi @josectello it's only missing the approval from @joshwnj and a couple missing tests.
Right now I don't have time to do the tests as I've started managing a project for the first time and it's been challenging.

Would be really helpful if you have time to review the tests, I can ask Josh to review after and push for a new release.

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

Successfully merging this pull request may close these issues.

3 participants