react-tooltip
react-tooltip copied to clipboard
After upgrading to react 18, tooltip not disappearing
I created a react app with CRA, installed react-tooltip, and used this code snippet:
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
same here it doesn't disappear in fresh create-react-app
same here 😭😭
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 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. 😞😞
+1
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);
}}
/>
</>
In my case had an issue with z-index (there was an element which was overflowing tooltip), just double-check z-indexes for elements
same problem here
@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
I have the same problem. But it works fine after removing <React.StrictMode> from root.
I have the same issue. Thanks @svmszcck for the tip
Hi, @zsofiath can you try the latest version of the package and let us know, please?
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!
Hi guys, regarding the @angelangelov88 comment, I'll close that issue.
Please feel free to open a new one if needed. Thanks!