Skip to content

Commit c5b9461

Browse files
authored
Merge pull request #58104 from software-mansion-labs/289Adam289/57805-fix-filter-tooltip
Render tooltip only when help pane is hidden
2 parents 68cf89a + 375ef09 commit c5b9461

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/components/ProductTrainingContext/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as Expensicons from '@components/Icon/Expensicons';
77
import Text from '@components/Text';
88
import useLocalize from '@hooks/useLocalize';
99
import useResponsiveLayout from '@hooks/useResponsiveLayout';
10+
import useSidePane from '@hooks/useSidePane';
1011
import useTheme from '@hooks/useTheme';
1112
import useThemeStyles from '@hooks/useThemeStyles';
1213
import {parseFSAttributes} from '@libs/Fullstory';
@@ -164,6 +165,7 @@ const useProductTrainingContext = (tooltipName: ProductTrainingTooltipName, shou
164165
const context = useContext(ProductTrainingContext);
165166
const styles = useThemeStyles();
166167
const theme = useTheme();
168+
const {shouldHideToolTip} = useSidePane();
167169
const {translate} = useLocalize();
168170

169171
if (!context) {
@@ -253,8 +255,8 @@ const useProductTrainingContext = (tooltipName: ProductTrainingTooltipName, shou
253255
]);
254256

255257
const shouldShowProductTrainingTooltip = useMemo(() => {
256-
return shouldShow && shouldRenderTooltip(tooltipName);
257-
}, [shouldRenderTooltip, tooltipName, shouldShow]);
258+
return shouldShow && shouldRenderTooltip(tooltipName) && !shouldHideToolTip;
259+
}, [shouldRenderTooltip, tooltipName, shouldShow, shouldHideToolTip]);
258260

259261
const hideProductTrainingTooltip = useCallback(() => {
260262
if (!shouldShowProductTrainingTooltip) {

src/components/SidePane/HelpButton.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import useSidePane from '@hooks/useSidePane';
1010
import useTheme from '@hooks/useTheme';
1111
import useThemeStyles from '@hooks/useThemeStyles';
1212
import {triggerSidePane} from '@libs/actions/SidePane';
13+
import KeyboardUtils from '@src/utils/keyboard';
1314

1415
type HelpButtonProps = {
1516
style?: StyleProp<ViewStyle>;
@@ -32,6 +33,7 @@ function HelpButton({style}: HelpButtonProps) {
3233
accessibilityLabel={translate('common.help')}
3334
style={[styles.flexRow, styles.touchableButtonImage, styles.mr2, style]}
3435
onPress={() => {
36+
KeyboardUtils.dismiss();
3537
triggerSidePane({
3638
isOpen: isExtraLargeScreenWidth ? !sidePane?.open : !sidePane?.openNarrowScreen,
3739
isOpenNarrowScreen: isExtraLargeScreenWidth ? undefined : !sidePane?.openNarrowScreen,

src/hooks/useSidePane.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ function useSidePane() {
3636
const shouldApplySidePaneOffset = isExtraLargeScreenWidth && !isPaneHidden;
3737

3838
const [shouldHideSidePane, setShouldHideSidePane] = useState(true);
39+
const [isAnimatingExtraLargeScree, setIsAnimatingExtraLargeScreen] = useState(false);
40+
3941
const shouldHideSidePaneBackdrop = isPaneHidden || isExtraLargeScreenWidth || shouldUseNarrowLayout;
42+
const shouldHideToolTip = isExtraLargeScreenWidth ? isAnimatingExtraLargeScree : !shouldHideSidePane;
4043

4144
// The help button is hidden when:
4245
// - side pane nvp is not set
@@ -51,6 +54,9 @@ function useSidePane() {
5154
if (!isPaneHidden) {
5255
setShouldHideSidePane(false);
5356
}
57+
if (isExtraLargeScreenWidth) {
58+
setIsAnimatingExtraLargeScreen(true);
59+
}
5460

5561
Animated.parallel([
5662
Animated.timing(sidePaneOffset.current, {
@@ -65,8 +71,9 @@ function useSidePane() {
6571
}),
6672
]).start(() => {
6773
setShouldHideSidePane(isPaneHidden);
74+
setIsAnimatingExtraLargeScreen(false);
6875
});
69-
}, [isPaneHidden, shouldApplySidePaneOffset, shouldUseNarrowLayout, sidePaneWidth]);
76+
}, [isPaneHidden, shouldApplySidePaneOffset, shouldUseNarrowLayout, sidePaneWidth, isExtraLargeScreenWidth]);
7077

7178
const closeSidePane = useCallback(
7279
(shouldUpdateNarrow = false) => {
@@ -90,6 +97,7 @@ function useSidePane() {
9097
shouldHideHelpButton,
9198
sidePaneOffset,
9299
sidePaneTranslateX,
100+
shouldHideToolTip,
93101
closeSidePane,
94102
};
95103
}

0 commit comments

Comments
 (0)