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.

checkShown callback

See original GitHub issue

I am using react with tippyjs. My tooltip content is hardly dynamic and interactive. User selecting components and editing it in tooltip. In my scenario tooltip must be show after tooltip content is rendered. My solution is https://github.com/ismail-codar/tippyjs/blob/master/src/js/tippy.js#L478

Usage:

new Tippy(domNode, {
        interactive: true,
        checkShown: (callback) => {
            const tooltipDom: HTMLElement = popup.getPopperElement(popup.tooltippedEls[0]).querySelector(".tippy-tooltip-content");
            //change model for react rendering 
            // ... some codes
            // ... some codes
            setTimeout(() => {
            //and react rendered here refresh tooltip content and call callback for tooltip showing
                if (tooltipDom.firstChild)
                   tooltipDom.firstChild.remove()
                tooltipDom.appendChild(activeTooltip.tooltipDomNode)
                callback()
            }, 0)
        }
    })

If @atomiks can be implement any solution like this integration with react like libraries is will be easy.

And another benefit is client side authority control etc can be done before tooltip open. I think https://github.com/atomiks/tippyjs/issues/23 related this.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tvkhoacommented, Apr 16, 2017

Hi @ismail-codar, I found a better solution for dynamic and interactive tooltip. Could you please check https://github.com/tvkhoa/react-tippy for that ? (disabled and html props)

Btw, @atomiks Thanks for your beautiful tooltip project. I port it to React component so that react user can use it conveniently. 😃

0reactions
tvkhoacommented, Apr 23, 2017

Hi @ismail-codar , I miss the notification so sorry for the late response. You can pass the react element to html prop. It’s sth like that

const TooltipContent = ({ name }) => (
  <div>
    <p>Name: {name}</p>
    ...
  </div>
);
...
<Tooltip html={<TooltipContent name={name} />}>
  <button onClick={changeName}>Change Name</button>
</Tooltip>

I think your current solution in React is an error-prone. Example: you can not pass the event like onChange or onClick to your tooltip content.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inline callback function within a callback? - Stack Overflow
The animate callback is a closure¹, ² over var1 and callback (more accurately, over the lexical environment they exist within), so they'll remain ......
Read more >
How to use the ModelCheckpoint callback with Keras and ...
Learn how to monitor a given metric such as validation loss during training and then save high-performing networks to disk.
Read more >
trade-liberalization-and-chinese-students-us-higher-education ...
The results of this check, shown in the third row in Table 5, ... a US degree receive lower call-back rates than Chinese...
Read more >
Setting up wolfEngine to be used with OpenSSL (Page 1)
I would like to perform the sanity check shown at 16:00 in the webinar but I'm not sure where the shared object resides...
Read more >
Vueper Slides - GitHub Pages
checkShow multiple items per slides. checkInfinite looping, customizable arrows or ... checkEmitted events for callbacks, etc... checkSupports RTL direction.
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