Git Product home page Git Product logo

react-tooltip-component's People

Contributors

minhtranite avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-tooltip-component's Issues

Why do you use mousemove/mouseout instead of mouseenter/mouseleave?

I don't see any need to continue firing off the callbacks when you're moving within the element. For me, mousemove has resulted in some tooltips having instability/jittery effects. By using mouseenter/mouseleave, you completely bypass that because the position only gets calculated once.

Just curious if this was an important design decision. Otherwise, I'd switch the events you set up listeners on.

Problem using react-tooltip-component on the server side

I'm getting this error while using the react-tooltip-component on the server side.

/front/node_modules/react-tooltip-component/lib/Tooltip.js:188
      container: document.body,
                 ^
ReferenceError: document is not defined
    at /Users/rloubradou/workspace/front/node_modules/react-tooltip-component/lib/Tooltip.js:188:18

Setting container: null fixes the issue, and the component is still functional.

Render title if not a string

If you check the value of title is not a string, assume that it is a react element, this allows for the tooltip to render anything in the tooltip with no issues

renderTooltip = (element) => {
    if (typeof this.props.title === 'string') {
      element.textContent = this.props.title;
    } else {
      ReactDOM.render(this.props.title, element);
    }
  };
componentDidMount = () => {
    // Removed code
    let tooltipContentEl = document.createElement('div');
    tooltipContentEl.className = 'tooltip-inner';
    this.renderTooltip(tooltipContentEl);
    // Removed code
  };
componentDidUpdate = () => {
    this.tooltipEl.className = 'tooltip ' + this.props.position;
    this.renderTooltip(this.tooltipEl.childNodes[1]);
  };

(Notice how the second text is strong)

image

image

By doing this I can also use React.Fragment to allow direct rendering to that tooltip element

image
image

<Tooltip title={<React.Fragment>Test <strong>Test</strong></React.Fragment>}>{/*Removed*/}</Tooltip>

No License File

Love the component, thanks!

However, there is no License file in the directory of the project nor the readme.
I see it's stated in the package.json however as in other projects, its convention to put it in the root directory under the file name LICENSE.

May I suggest the MIT license such as in this project
https://github.com/reactjs/react-tabs/blob/master/LICENSE

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.