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

After upgrading to react 18, tooltip not disappearing

Open zsofiath opened this issue 2 years ago • 11 comments

I created a react app with CRA, installed react-tooltip, and used this code snippet:

image

After mouseleave event, the tooltip remains visible.

I've found the snippet here: https://codesandbox.io/s/heuristic-curran-bddeu?fontsize=14&hidenavigation=1&theme=dark

zsofiath avatar Apr 07 '22 06:04 zsofiath

same here it doesn't disappear in fresh create-react-app

amirho1 avatar Apr 09 '22 10:04 amirho1

same here 😭😭

Suzan-Dev avatar Apr 28 '22 15:04 Suzan-Dev

what I understand about this issue is; it's only in development and it doesn't have any problems in the production build test it; I red some were but I didn't test it @Suzan-Dev but I myself downgraded to 17 because it seems a lot of packages have problem with 18

amirho1 avatar Apr 28 '22 16:04 amirho1

@amirho1 Yeah, same here. I read about that here #763 but still choose to downgrade to v17. React 18 is here but packages are not up to date. 😞😞

Suzan-Dev avatar Apr 28 '22 16:04 Suzan-Dev

+1

vova42matters avatar May 03 '22 13:05 vova42matters

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

In my case had an issue with z-index (there was an element which was overflowing tooltip), just double-check z-indexes for elements

vova42matters avatar May 06 '22 06:05 vova42matters

same problem here

briva avatar Aug 01 '22 20:08 briva

@briva and others who came here, I think it doesn't work on the development, Please check it on production, it seems; it's working correctly

amirho1 avatar Aug 02 '22 05:08 amirho1

I have the same problem. But it works fine after removing <React.StrictMode> from root.

voldo5 avatar Aug 03 '22 09:08 voldo5

I have the same issue. Thanks @svmszcck for the tip

angelangelov88 avatar Sep 02 '22 16:09 angelangelov88

Hi, @zsofiath can you try the latest version of the package and let us know, please?

danielbarion avatar Oct 14 '22 14:10 danielbarion

Hi @zsofiath,

I was having this same issue previously and had to use react-tooltip-rc to make it work properly on React 18. Have just tried again with react-tooltip and it all works great now.

Thanks a lot!

angelangelov88 avatar Oct 17 '22 07:10 angelangelov88

Hi guys, regarding the @angelangelov88 comment, I'll close that issue.

Please feel free to open a new one if needed. Thanks!

danielbarion avatar Oct 17 '22 11:10 danielbarion