ethanselzer / react-cursor-position

A React component that decorates its children with mouse and touch coordinates relative to itself.
https://ethanselzer.github.io/react-cursor-position
MIT License
143 stars 35 forks source link

A way to prevent passing cursorPosition to children #1

Closed alex-golovanov closed 8 years ago

alex-golovanov commented 8 years ago

Hi, would you consider not passing cursorPosition to children by default, or at least a way to prevent it, maybe by adding another parameter?

The reason I ask is because of:

Warning: Unknown prop cursorPosition on tag. Remove this prop from the element.

Most if not all elements will issue this warning. I'm aware that I can wrap those elements in a custom component, but that would add an unnecessary layer.

ethanselzer commented 8 years ago

Thanks for opening this issue! I really appreciate you raising my awareness to the Unknown prop warning message, and suggesting support for optionally suppressing decoration of child components with cursor position information.

I think both concerns have been addressed. Standard HTML DOM nodes will no longer be decorated with cursor information, which should prevent the warning message you identified. Also a new property named shouldDecorateChildren has been added. It defaults to true to preserve backwards compatibility, but can optionally be set to false to prevent all child nodes from being decorated with cursor position information.

Thanks again. I hope you find this component useful!

ethanselzer commented 8 years ago

The npm package for this project has been updated to Version 1.01.

alex-golovanov commented 8 years ago

Perfect, thank you very much!