Skip to content

Commit

Permalink
fix: use content from activeAnchor on render()
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieljablonski committed Feb 10, 2024
1 parent 758df51 commit 58a5b79
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/TooltipController/TooltipController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
let renderedContent: ChildrenType = children
const contentWrapperRef = useRef<HTMLDivElement>(null)
if (render) {
const rendered = render({ content: tooltipContent ?? null, activeAnchor }) as React.ReactNode
const actualContent =
activeAnchor?.getAttribute('data-tooltip-content') || tooltipContent || null
const rendered = render({ content: actualContent, activeAnchor }) as React.ReactNode
renderedContent = rendered ? (
<div ref={contentWrapperRef} className="react-tooltip-content-wrapper">
{rendered}
Expand Down

0 comments on commit 58a5b79

Please sign in to comment.