Rewrite visibility sensor to hooks#161
Open
sergio-toro wants to merge 14 commits intojoshwnj:masterfrom
Open
Conversation
pull latest changes
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
Contributor
|
https://github.com/roderickhsiao/react-in-viewport already has a hook-based API. Maybe just add a link to it in docs? |
|
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... :) |
Author
|
Hi @josectello it's only missing the approval from @joshwnj and a couple missing tests. 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR:
findDOMNodedeprecation warning Fix findDOMNode deprecation warning #160useVisibilitySensorhook for more powerful integrations.16.8.x.Missing:
actcalls 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.