Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useNavigation} from '@react-navigation/native';
import React, {memo, useEffect, useRef, useState} from 'react';
import {NavigationContext} from '@react-navigation/native';
import React, {memo, useContext, useEffect, useRef, useState} from 'react';
import type {LayoutRectangle, NativeSyntheticEvent} from 'react-native';
import GenericTooltip from '@components/Tooltip/GenericTooltip';
import type {EducationalTooltipProps} from '@components/Tooltip/types';
Expand All @@ -17,7 +17,7 @@ function BaseEducationalTooltip({children, shouldRender = false, shouldHideOnNav
const [shouldMeasure, setShouldMeasure] = useState(false);
const show = useRef<() => void>();

const navigation = useNavigation();
const navigator = useContext(NavigationContext);

useEffect(() => {
return () => {
Expand All @@ -43,14 +43,17 @@ function BaseEducationalTooltip({children, shouldRender = false, shouldHideOnNav
}, [shouldMeasure, shouldRender]);

useEffect(() => {
const unsubscribe = navigation.addListener('blur', () => {
if (!navigator) {
return;
}
const unsubscribe = navigator.addListener('blur', () => {
if (!shouldHideOnNavigate) {
return;
}
hideTooltipRef.current?.();
});
return unsubscribe;
}, [navigation, shouldHideOnNavigate]);
}, [navigator, shouldHideOnNavigate]);

return (
<GenericTooltip
Expand Down