diff --git a/src/components/Tooltip/BaseTooltip/index.tsx b/src/components/Tooltip/BaseTooltip/index.tsx index e2a2c46e4546..6530d81da6dc 100644 --- a/src/components/Tooltip/BaseTooltip/index.tsx +++ b/src/components/Tooltip/BaseTooltip/index.tsx @@ -1,5 +1,5 @@ import {BoundsObserver} from '@react-ng/bounds-observer'; -import React, {ForwardedRef, forwardRef, memo, useCallback, useEffect, useRef, useState} from 'react'; +import React, {memo, useCallback, useEffect, useRef, useState} from 'react'; import {Animated} from 'react-native'; import Hoverable from '@components/Hoverable'; import TooltipRenderedOnPageBody from '@components/Tooltip/TooltipRenderedOnPageBody'; @@ -55,20 +55,18 @@ function chooseBoundingBox(target: HTMLElement, clientX: number, clientY: number return target.getBoundingClientRect(); } -function Tooltip( - { - children, - numberOfLines = CONST.TOOLTIP_MAX_LINES, - maxWidth = variables.sideBarWidth, - text = '', - renderTooltipContent, - renderTooltipContentKey = [], - shouldHandleScroll = false, - shiftHorizontal = 0, - shiftVertical = 0, - }: TooltipProps, - ref: ForwardedRef, -) { +function Tooltip({ + children, + numberOfLines = CONST.TOOLTIP_MAX_LINES, + maxWidth = variables.sideBarWidth, + text = '', + renderTooltipContent, + renderTooltipContentKey = [], + shouldHandleScroll = false, + shiftHorizontal = 0, + shiftVertical = 0, + tooltipRef, +}: TooltipProps) { const {preferredLocale} = useLocalize(); const {windowWidth} = useWindowDimensions(); @@ -214,7 +212,7 @@ function Tooltip( {children} diff --git a/src/components/Tooltip/types.ts b/src/components/Tooltip/types.ts index df95c3ea5979..6388c14741ab 100644 --- a/src/components/Tooltip/types.ts +++ b/src/components/Tooltip/types.ts @@ -1,4 +1,5 @@ -import {ReactElement, ReactNode} from 'react'; +import {BoundsObserver} from '@react-ng/bounds-observer'; +import {ReactElement, ReactNode, RefObject} from 'react'; type TooltipProps = { /** The text to display in the tooltip. If text is ommitted, only children will be rendered. */ @@ -29,6 +30,9 @@ type TooltipProps = { /** passes this down to Hoverable component to decide whether to handle the scroll behaviour to show hover once the scroll ends */ shouldHandleScroll?: boolean; + + /** Reference to the tooltip container */ + tooltipRef?: RefObject | null; }; type TooltipExtendedProps = TooltipProps & {