diff --git a/src/components/LHNOptionsList/LHNOptionsList.tsx b/src/components/LHNOptionsList/LHNOptionsList.tsx index df4b0677c244..6479478fef58 100644 --- a/src/components/LHNOptionsList/LHNOptionsList.tsx +++ b/src/components/LHNOptionsList/LHNOptionsList.tsx @@ -15,6 +15,7 @@ import useLHNEstimatedListSize from '@hooks/useLHNEstimatedListSize'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import usePrevious from '@hooks/usePrevious'; +import useScrollEventEmitter from '@hooks/useScrollEventEmitter'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import {isValidDraftComment} from '@libs/DraftCommentUtils'; @@ -68,6 +69,10 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio onFirstItemRendered(); }, [onFirstItemRendered]); + // Controls the visibility of the educational tooltip based on user scrolling. + // Hides the tooltip when the user is scrolling and displays it once scrolling stops. + const triggerScrollEvent = useScrollEventEmitter(); + const emptyLHNSubtitle = useMemo( () => ( @@ -262,8 +267,9 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio if (isWebOrDesktop) { saveScrollIndex(route, Math.floor(e.nativeEvent.contentOffset.y / estimatedItemSize)); } + triggerScrollEvent(); }, - [estimatedItemSize, isWebOrDesktop, route, saveScrollIndex, saveScrollOffset], + [estimatedItemSize, isWebOrDesktop, route, saveScrollIndex, saveScrollOffset, triggerScrollEvent], ); const onLayout = useCallback(() => { diff --git a/src/components/LHNOptionsList/OptionRowLHN.tsx b/src/components/LHNOptionsList/OptionRowLHN.tsx index 49f4414d0638..a4e0164e388b 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.tsx +++ b/src/components/LHNOptionsList/OptionRowLHN.tsx @@ -198,6 +198,7 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti shiftVertical={shouldShowWokspaceChatTooltip ? 0 : variables.composerTooltipShiftVertical} wrapperStyle={styles.productTrainingTooltipWrapper} onTooltipPress={onOptionPress} + shouldHideOnScroll > diff --git a/src/components/Search/SearchPageHeader/SearchPageHeader.tsx b/src/components/Search/SearchPageHeader/SearchPageHeader.tsx index a3b814650a23..8197083b44c0 100644 --- a/src/components/Search/SearchPageHeader/SearchPageHeader.tsx +++ b/src/components/Search/SearchPageHeader/SearchPageHeader.tsx @@ -359,6 +359,7 @@ function SearchPageHeader({queryJSON, searchName, searchRouterListVisible, hideS wrapperStyle={styles.productTrainingTooltipWrapper} renderTooltipContent={renderProductTrainingTooltip} onTooltipPress={onFiltersButtonPress} + shouldHideOnScroll >