Skip to content

Commit 0b86989

Browse files
committed
Fix educational tooltip type error
1 parent 52ba229 commit 0b86989

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/Tooltip/EducationalTooltip/BaseEducationalTooltip.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React, {memo, useEffect, useRef} from 'react';
22
import {InteractionManager} from 'react-native';
3-
import type {LayoutChangeEvent} from 'react-native';
3+
import type {LayoutRectangle, NativeSyntheticEvent} from 'react-native';
44
import GenericTooltip from '@components/Tooltip/GenericTooltip';
55
import type {EducationalTooltipProps} from '@components/Tooltip/types';
66
import CONST from '@src/CONST';
77

8+
type LayoutChangeEventWithTarget = NativeSyntheticEvent<{layout: LayoutRectangle; target: HTMLElement}>;
9+
810
/**
911
* A component used to wrap an element intended for displaying a tooltip.
1012
* This tooltip would show immediately without user's interaction and hide after 5 seconds.
@@ -45,7 +47,7 @@ function BaseEducationalTooltip({children, shouldAutoDismiss = false, ...props}:
4547
// eslint-disable-next-line react-compiler/react-compiler
4648
hideTooltipRef.current = hideTooltip;
4749
return React.cloneElement(children as React.ReactElement, {
48-
onLayout: (e: LayoutChangeEvent) => {
50+
onLayout: (e: LayoutChangeEventWithTarget) => {
4951
// e.target is specific to native, use e.nativeEvent.target on web instead
5052
const target = e.target || e.nativeEvent.target;
5153
// When tooltip is used inside an animated view (e.g. popover), we need to wait for the animation to finish before measuring content.

0 commit comments

Comments
 (0)