react-tooltip icon indicating copy to clipboard operation
react-tooltip copied to clipboard

ReactTooltip won't hide

Open MarshyMadness opened this issue 2 years ago • 6 comments

Tooltip never closes and if another one shows up then both are on screen so with many tooltips the screen becomes unreadable

MarshyMadness avatar Apr 13 '22 23:04 MarshyMadness

I think u are using react 18 a solution is to downgrade to react 17

amirho1 avatar Apr 18 '22 12:04 amirho1

Is there a plan to support React 18? This only occurs in Development Strict Mode. ReactTooltip works fine in Production code with React 18.

Raymond-OJam avatar Apr 21 '22 23:04 Raymond-OJam

As a quick fix you can do this until the package is updated:

const [tooltip, showTooltip] = useState(true);

<>
 {tooltip && <ReactTooltip effect="solid" />}
 <p
   data-tip="hello world"
   onMouseEnter={() => showTooltip(true)}
   onMouseLeave={() => {
     showTooltip(false);
     setTimeout(() => showTooltip(true), 50);
   }}
 />
</>

svmszcck avatar May 05 '22 23:05 svmszcck

Is there a plan to support React 18? This only occurs in Development Strict Mode. ReactTooltip works fine in Production code with React 18.

Exactly, it runs normally if we remove Strict Mode in root app, of React 18.

hoainamcr avatar Jul 14 '22 10:07 hoainamcr

You can place ReactTooltip outside of React.StrictMode, for example:

<>
  <React.StrictMode>
    <App />
  </React.StrictMode>
  <ReactTooltip />
</>

j-francisco avatar Aug 05 '22 20:08 j-francisco

You can place ReactTooltip outside of React.StrictMode, for example:

<>
  <React.StrictMode>
    <App />
  </React.StrictMode>
  <ReactTooltip />
</>

Yeah, this solution is Ok for general case, but in the special cases we have ro define the the tooltip component in each components. it is happen the same above while development :D

hoainamcr avatar Aug 11 '22 10:08 hoainamcr

Hi guys, the release v4.3.0 enables support for React 18 and Next.js strict mode, thanks to @pdeszynski.

danielbarion avatar Oct 13 '22 19:10 danielbarion