question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When changing the data-tip doesn't refresh the the tooltip

See original GitHub issue

I have this tooltip, that has a dynamic data-tip:

<span data-tip={switchTip} onClick={this.props.switchType}><i className="icon-refresh" />Switch to {oppositeType}</span>

when switchTip changes, it doesn’t refresh the information inside the data-tip, is this an issue, or more like a feature?

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
alejandrosobkocommented, Jul 16, 2018

You have to add getContent to the ReactTooltip. This worked for me:

<span data-tip={this.copyMessage()} />
<ReactTooltip effect="solid" getContent={this.copyMessage} />

copyMessage is the function that returns the message dynamically.

0reactions
SlimGabsicommented, Jun 30, 2022

the solution is to hide and then show the tooltip on state change and if your cmp is hovered . Note that am using functional cmps and useRef hook I guess you can do the same with componentDidUpdate() use onMouseEnter and onMouseLeave to set the hovred state

        const handleOnMouseLeave = () => {
		setIsHovered(false);
	};
	const handleOnMouseEnter = () => {
		setIsHovered(true);
	};

		useEffect(() => {
       if (myRef?.current && isHovered) {
		ReactTooltip.hide();
		ReactTooltip.show(myRef.current);
	}, [myState]);


Read more comments on GitHub >

github_iconTop Results From Across the Web

When changing the data-tip doesn't refresh the the tooltip #27
I have this tooltip, that has a dynamic data-tip: Switch to {oppositeType} when switchTip changes, it doesn't refresh the information inside ...
Read more >
React-Tooltip not displaying until page is refreshed
I've implemented tooltips, but they only display once I refresh the page! Here is a GIF reproducing the issue:.
Read more >
Datatips don't disappear - MATLAB Answers - MathWorks
Hi, When the mouse hovers over a variable, a partial display of the data appears as a tooltip (I think this is called...
Read more >
Report Tooltip doesn't change - Microsoft Power BI Community
I have created a report in which I am using a Report Tooltip, and it is working just fine on Power BI Desktop....
Read more >
Tooltips · Bootstrap v5.0
Documentation and examples for adding custom Bootstrap tooltips with CSS and ... Tooltip position attempts to automatically change when a parent container ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found