-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix tooltip for QAB doesn't show for new user #52446
Changes from 3 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,29 @@ | ||||||||||||||||||||||
const pendingTooltip: NodeJS.Timeout[] = []; | ||||||||||||||||||||||
const tooltipCloseCallback: Array<() => void> = []; | ||||||||||||||||||||||
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.
Suggested change
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.
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
function addPendingTooltip(timeout: NodeJS.Timeout) { | ||||||||||||||||||||||
pendingTooltip.push(timeout); | ||||||||||||||||||||||
return () => { | ||||||||||||||||||||||
const index = pendingTooltip.indexOf(timeout); | ||||||||||||||||||||||
pendingTooltip.splice(index, 1); | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
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.
Suggested change
|
||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
function addActiveTooltip(closeCallback: () => void) { | ||||||||||||||||||||||
tooltipCloseCallback.push(closeCallback); | ||||||||||||||||||||||
return () => { | ||||||||||||||||||||||
const index = tooltipCloseCallback.indexOf(closeCallback); | ||||||||||||||||||||||
tooltipCloseCallback.splice(index, 1); | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
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.
Suggested change
|
||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
function cancelPendingAndActiveTooltips() { | ||||||||||||||||||||||
while (pendingTooltip.length > 0) { | ||||||||||||||||||||||
clearTimeout(pendingTooltip.pop()); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
while (tooltipCloseCallback.length > 0) { | ||||||||||||||||||||||
tooltipCloseCallback.pop()?.(); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
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.
Suggested change
|
||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
export {addPendingTooltip, addActiveTooltip, cancelPendingAndActiveTooltips}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,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'; | ||
|
@@ -202,6 +203,7 @@ const RootStack = createCustomStackNavigator<AuthScreensParamList>(); | |
|
||
const modalScreenListeners = { | ||
focus: () => { | ||
TooltipManager.cancelPendingAndActiveTooltips(); | ||
Modal.setModalVisibility(true); | ||
}, | ||
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 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,9 @@ function setDisableDismissOnEscape(disableDismissOnEscape: boolean) { | |||||||||||||||||||||||||||||
* isPopover indicates that the next open modal is popover or bottom docked | ||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||
function willAlertModalBecomeVisible(isVisible: boolean, isPopover = false) { | ||||||||||||||||||||||||||||||
if (isVisible) { | ||||||||||||||||||||||||||||||
TooltipManager.cancelPendingAndActiveTooltips(); | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
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
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}); | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.