Skip to content

Commit

Permalink
Fix QAB tooltip does not hide immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
rayane-djouah committed Jan 5, 2025
1 parent 473cad5 commit b4187ee
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useNavigation} from '@react-navigation/native';
import React, {memo, useEffect, useRef, useState} from 'react';
import type {LayoutRectangle, NativeSyntheticEvent} from 'react-native';
import GenericTooltip from '@components/Tooltip/GenericTooltip';
Expand All @@ -16,6 +17,8 @@ function BaseEducationalTooltip({children, shouldRender = false, ...props}: Educ
const [shouldMeasure, setShouldMeasure] = useState(false);
const show = useRef<() => void>();

const navigation = useNavigation();

useEffect(() => {
return () => {
hideTooltipRef.current?.();
Expand All @@ -39,6 +42,13 @@ function BaseEducationalTooltip({children, shouldRender = false, ...props}: Educ
};
}, [shouldMeasure, shouldRender]);

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

return (
<GenericTooltip
shouldForceAnimate
Expand Down

0 comments on commit b4187ee

Please sign in to comment.