Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent tooltip from showing when a fullscreen is visible #55593

Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ const ONYXKEYS = {
/** Keeps track if there is modal currently visible or not */
MODAL: 'modal',

/** Keeps track if there is a full screen currently visible or not */
FULLSCREEN_VISIBILITY: 'fullscreenVisibility',

/** Has information about the network status (offline/online) */
NETWORK: 'network',

Expand Down Expand Up @@ -910,6 +913,7 @@ type OnyxValuesMapping = {
[ONYXKEYS.CREDENTIALS]: OnyxTypes.Credentials;
[ONYXKEYS.STASHED_CREDENTIALS]: OnyxTypes.Credentials;
[ONYXKEYS.MODAL]: OnyxTypes.Modal;
[ONYXKEYS.FULLSCREEN_VISIBILITY]: boolean;
[ONYXKEYS.NETWORK]: OnyxTypes.Network;
[ONYXKEYS.NEW_GROUP_CHAT_DRAFT]: OnyxTypes.NewGroupChatDraft;
[ONYXKEYS.CUSTOM_STATUS_DRAFT]: OnyxTypes.CustomStatusDraft;
Expand Down
5 changes: 3 additions & 2 deletions src/components/LHNOptionsList/OptionRowLHN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${optionItem?.reportID}`);
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [isFullscreenVisible] = useOnyx(ONYXKEYS.FULLSCREEN_VISIBILITY);
const session = useSession();
const shouldShowWokspaceChatTooltip = isPolicyExpenseChat(report) && activePolicyID === report?.policyID && session?.accountID === report?.ownerAccountID;
const isOnboardingGuideAssigned = introSelected?.choice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM && !session?.email?.includes('+');
Expand All @@ -68,11 +69,11 @@ function OptionRowLHN({reportID, isFocused = false, onSelectRow = () => {}, opti
const {tooltipToRender, shouldShowTooltip} = useMemo(() => {
const tooltip = shouldShowGetStartedTooltip ? CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.CONCEIRGE_LHN_GBR : CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.LHN_WORKSPACE_CHAT_TOOLTIP;
const shouldShowTooltips = shouldShowWokspaceChatTooltip || shouldShowGetStartedTooltip;
const shouldTooltipBeVisible = shouldUseNarrowLayout ? isScreenFocused && isActiveRouteHome : isActiveRouteHome;
const shouldTooltipBeVisible = shouldUseNarrowLayout ? isScreenFocused && isActiveRouteHome : isActiveRouteHome && !isFullscreenVisible;

// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
return {tooltipToRender: tooltip, shouldShowTooltip: shouldShowTooltips && shouldTooltipBeVisible};
}, [shouldShowGetStartedTooltip, shouldShowWokspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isActiveRouteHome]);
}, [shouldShowGetStartedTooltip, shouldShowWokspaceChatTooltip, isScreenFocused, shouldUseNarrowLayout, isActiveRouteHome, isFullscreenVisible]);

const {shouldShowProductTrainingTooltip, renderProductTrainingTooltip, hideProductTrainingTooltip} = useProductTrainingContext(tooltipToRender, shouldShowTooltip);

Expand Down
12 changes: 12 additions & 0 deletions src/libs/Navigation/AppNavigator/AuthScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import usePermissions from '@hooks/usePermissions';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import setFullscreenVisibility from '@libs/actions/setFullscreenVisibility';
import {READ_COMMANDS} from '@libs/API/types';
import HttpUtils from '@libs/HttpUtils';
import KeyboardShortcut from '@libs/KeyboardShortcut';
Expand Down Expand Up @@ -220,6 +221,15 @@ const modalScreenListeners = {
},
};

const fullScreenListeners = {
focus: () => {
setFullscreenVisibility(true);
},
beforeRemove: () => {
setFullscreenVisibility(false);
},
};

// Extended modal screen listeners with additional cancellation of pending requests
const modalScreenListenersWithCancelSearch = {
...modalScreenListeners,
Expand Down Expand Up @@ -460,6 +470,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
headerShown: false,
title: 'New Expensify',
}}
listeners={fullScreenListeners}
getComponent={loadValidateLoginPage}
/>
<RootStack.Screen
Expand Down Expand Up @@ -523,6 +534,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
name={SCREENS.NOT_FOUND}
options={rootNavigatorOptions.fullScreen}
component={NotFoundPage}
listeners={fullScreenListeners}
/>
<RootStack.Screen
name={NAVIGATORS.RIGHT_MODAL_NAVIGATOR}
Expand Down
6 changes: 6 additions & 0 deletions src/libs/actions/setFullscreenVisibility.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Onyx from 'react-native-onyx';
import ONYXKEYS from '@src/ONYXKEYS';

export default function setFullscreenVisibility(isVisible: boolean) {
Onyx.merge(ONYXKEYS.FULLSCREEN_VISIBILITY, isVisible);
}
Loading