-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix tooltip for QAB doesn't show for new user #52446
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
Changes from all commits
1051bda
da87273
3b05518
98bc0ea
c3efa31
7538b46
2fc61f7
e6ed429
8aec50b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // We store the timeouts for each pending tooltip here. | ||
| // We're using the timeout because when a tooltip is used inside an animated view (e.g., popover), | ||
| // we need to wait for the animation to finish before measuring content. | ||
| const pendingTooltips = new Set<NodeJS.Timeout>(); | ||
|
|
||
| // We store the callback for closing a tooltip here. | ||
| const activeTooltips = new Set<() => void>(); | ||
|
|
||
| function addPendingTooltip(timeout: NodeJS.Timeout) { | ||
| pendingTooltips.add(timeout); | ||
| return () => { | ||
| pendingTooltips.delete(timeout); | ||
| }; | ||
| } | ||
|
|
||
| function addActiveTooltip(closeCallback: () => void) { | ||
| activeTooltips.add(closeCallback); | ||
| return () => { | ||
| activeTooltips.delete(closeCallback); | ||
| }; | ||
| } | ||
|
|
||
| function cancelPendingAndActiveTooltips() { | ||
| pendingTooltips.forEach((timeout) => clearTimeout(timeout)); | ||
| pendingTooltips.clear(); | ||
| activeTooltips.forEach((closeCallback) => closeCallback()); | ||
| activeTooltips.clear(); | ||
| } | ||
|
|
||
| export {addPendingTooltip, addActiveTooltip, cancelPendingAndActiveTooltips}; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import {SearchContextProvider} from '@components/Search/SearchContext'; | |
| import {useSearchRouterContext} from '@components/Search/SearchRouter/SearchRouterContext'; | ||
| import SearchRouterModal from '@components/Search/SearchRouter/SearchRouterModal'; | ||
| import TestToolsModal from '@components/TestToolsModal'; | ||
| import * as TooltipManager from '@components/Tooltip/EducationalTooltip/TooltipManager'; | ||
| import useActiveWorkspace from '@hooks/useActiveWorkspace'; | ||
| import useOnboardingFlowRouter from '@hooks/useOnboardingFlow'; | ||
| import usePermissions from '@hooks/usePermissions'; | ||
|
|
@@ -204,6 +205,8 @@ const RootStack = createCustomStackNavigator<AuthScreensParamList>(); | |
|
|
||
| const modalScreenListeners = { | ||
| focus: () => { | ||
| // Since we don't cancel the tooltip in setModalVisibility, we need to do it here so it will be cancelled when a modal screen is shown. | ||
| TooltipManager.cancelPendingAndActiveTooltips(); | ||
| Modal.setModalVisibility(true); | ||
| }, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And because the RHP modal uses
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add a comment in the code for this? |
||
| blur: () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||||||||||||||||||||||||||
| import Onyx from 'react-native-onyx'; | ||||||||||||||||||||||||||||||
| import * as TooltipManager from '@components/Tooltip/EducationalTooltip/TooltipManager'; | ||||||||||||||||||||||||||||||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const closeModals: Array<(isNavigating?: boolean) => void> = []; | ||||||||||||||||||||||||||||||
|
|
@@ -86,6 +87,12 @@ function setDisableDismissOnEscape(disableDismissOnEscape: boolean) { | |||||||||||||||||||||||||||||
| * isPopover indicates that the next open modal is popover or bottom docked | ||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||
| function willAlertModalBecomeVisible(isVisible: boolean, isPopover = false) { | ||||||||||||||||||||||||||||||
| // We cancel the pending and active tooltips here instead of in setModalVisibility because | ||||||||||||||||||||||||||||||
| // we want to do it when a modal is going to show. If we do it when the modal is fully shown, | ||||||||||||||||||||||||||||||
| // the tooltip in that modal won't show. | ||||||||||||||||||||||||||||||
| if (isVisible) { | ||||||||||||||||||||||||||||||
| TooltipManager.cancelPendingAndActiveTooltips(); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We only cancel it in App/src/components/Modal/BaseModal.tsx Lines 102 to 109 in 7256ad6
App/src/components/Modal/BaseModal.tsx Lines 131 to 136 in 7256ad6
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add a comment in the code for this? |
||||||||||||||||||||||||||||||
| Onyx.merge(ONYXKEYS.MODAL, {willAlertModalBecomeVisible: isVisible, isPopover}); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.