-
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: ignore other actions if navigation in progress in menu Items #28338
Merged
MonilBhavsar
merged 24 commits into
Expensify:main
from
ishpaul777:fix/quickly-pressing-different-menuitems
Oct 25, 2023
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
10922f7
fix: ignore other actions if navigation in progress in worksspace set…
ishpaul777 d4fef7a
Merge branch 'Expensify:main' into fix/quickly-pressing-different-men…
ishpaul777 76ef509
added fix for all security, workspace and aboutpage
ishpaul777 7d8fda9
remove console log
ishpaul777 6c90c16
fix linters
ishpaul777 31abad1
added requested changes
ishpaul777 c99fd1c
added comment why execption made for mapping menuitems
ishpaul777 092fd1b
resolve conflicts
ishpaul777 7dc1771
Merge branch 'main' into fix/quickly-pressing-different-menuitems
ishpaul777 31ca2f8
fixed some more conflicts
ishpaul777 2dfd0ea
Merge branch 'main' into fix/quickly-pressing-different-menuitems
ishpaul777 64ed5e6
fix unneccessary prop passing to backbutton
ishpaul777 89a1320
fix linters
ishpaul777 2f81e3b
cleaning up the code
ishpaul777 d12e538
Merge branch 'main' into fix/quickly-pressing-different-menuitems
ishpaul777 3ce0a1b
Update src/components/MenuItemList.js
ishpaul777 aa5a1c7
Update src/components/HeaderWithBackButton/headerWithBackButtonPropTy…
ishpaul777 dbc44ae
added suggested changes and fix hide of assistance button when delete…
ishpaul777 1832899
Update src/components/HeaderWithBackButton/headerWithBackButtonPropTy…
ishpaul777 689fe1d
Update src/components/HeaderWithBackButton/headerWithBackButtonPropTy…
ishpaul777 0bb8866
Update src/pages/workspace/WorkspaceInitialPage.js
ishpaul777 6c220e6
fix menu item blinking when modal is visible
ishpaul777 e665fbf
Merge branch 'fix/quickly-pressing-different-menuitems' of https://gi…
ishpaul777 38e6e69
Merge branch 'main' into fix/quickly-pressing-different-menuitems
ishpaul777 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import _ from 'underscore'; | ||
import React from 'react'; | ||
import React, {useRef, useMemo} from 'react'; | ||
import {ScrollView, View} from 'react-native'; | ||
import DeviceInfo from 'react-native-device-info'; | ||
import HeaderWithBackButton from '../../../components/HeaderWithBackButton'; | ||
|
@@ -13,7 +13,6 @@ import * as Expensicons from '../../../components/Icon/Expensicons'; | |
import ScreenWrapper from '../../../components/ScreenWrapper'; | ||
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; | ||
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions'; | ||
import MenuItem from '../../../components/MenuItem'; | ||
import Logo from '../../../../assets/images/new-expensify.svg'; | ||
import pkg from '../../../../package.json'; | ||
import * as Report from '../../../libs/actions/Report'; | ||
|
@@ -22,6 +21,8 @@ import compose from '../../../libs/compose'; | |
import * as ReportActionContextMenu from '../../home/report/ContextMenu/ReportActionContextMenu'; | ||
import {CONTEXT_MENU_TYPES} from '../../home/report/ContextMenu/ContextMenuActions'; | ||
import * as Environment from '../../../libs/Environment/Environment'; | ||
import MenuItemList from '../../../components/MenuItemList'; | ||
import useWaitForNavigation from '../../../hooks/useWaitForNavigation'; | ||
|
||
const propTypes = { | ||
...withLocalizePropTypes, | ||
|
@@ -40,46 +41,57 @@ function getFlavor() { | |
} | ||
|
||
function AboutPage(props) { | ||
let popoverAnchor; | ||
const menuItems = [ | ||
{ | ||
translationKey: 'initialSettingsPage.aboutPage.appDownloadLinks', | ||
icon: Expensicons.Link, | ||
action: () => { | ||
Navigation.navigate(ROUTES.SETTINGS_APP_DOWNLOAD_LINKS); | ||
const {translate} = props; | ||
const popoverAnchor = useRef(null); | ||
const waitForNavigate = useWaitForNavigation(); | ||
|
||
const menuItems = useMemo(() => { | ||
const baseMenuItems = [ | ||
{ | ||
translationKey: 'initialSettingsPage.aboutPage.appDownloadLinks', | ||
icon: Expensicons.Link, | ||
action: waitForNavigate(() => Navigation.navigate(ROUTES.SETTINGS_APP_DOWNLOAD_LINKS)), | ||
}, | ||
{ | ||
translationKey: 'initialSettingsPage.aboutPage.viewKeyboardShortcuts', | ||
icon: Expensicons.Keyboard, | ||
action: waitForNavigate(() => Navigation.navigate(ROUTES.KEYBOARD_SHORTCUTS)), | ||
}, | ||
}, | ||
{ | ||
translationKey: 'initialSettingsPage.aboutPage.viewKeyboardShortcuts', | ||
icon: Expensicons.Keyboard, | ||
action: () => { | ||
Navigation.navigate(ROUTES.KEYBOARD_SHORTCUTS); | ||
{ | ||
translationKey: 'initialSettingsPage.aboutPage.viewTheCode', | ||
icon: Expensicons.Eye, | ||
iconRight: Expensicons.NewWindow, | ||
action: () => { | ||
Link.openExternalLink(CONST.GITHUB_URL); | ||
}, | ||
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. link for github url is missed here during refractor Causing this issue - #32965 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. No excuses.. i messed up here😅 |
||
}, | ||
}, | ||
{ | ||
translationKey: 'initialSettingsPage.aboutPage.viewTheCode', | ||
icon: Expensicons.Eye, | ||
iconRight: Expensicons.NewWindow, | ||
action: () => { | ||
Link.openExternalLink(CONST.GITHUB_URL); | ||
{ | ||
translationKey: 'initialSettingsPage.aboutPage.viewOpenJobs', | ||
icon: Expensicons.MoneyBag, | ||
iconRight: Expensicons.NewWindow, | ||
action: () => { | ||
Link.openExternalLink(CONST.UPWORK_URL); | ||
}, | ||
link: CONST.UPWORK_URL, | ||
}, | ||
link: CONST.GITHUB_URL, | ||
}, | ||
{ | ||
translationKey: 'initialSettingsPage.aboutPage.viewOpenJobs', | ||
icon: Expensicons.MoneyBag, | ||
iconRight: Expensicons.NewWindow, | ||
action: () => { | ||
Link.openExternalLink(CONST.UPWORK_URL); | ||
{ | ||
translationKey: 'initialSettingsPage.aboutPage.reportABug', | ||
icon: Expensicons.Bug, | ||
action: waitForNavigate(Report.navigateToConciergeChat), | ||
}, | ||
link: CONST.UPWORK_URL, | ||
}, | ||
{ | ||
translationKey: 'initialSettingsPage.aboutPage.reportABug', | ||
icon: Expensicons.Bug, | ||
action: Report.navigateToConciergeChat, | ||
}, | ||
]; | ||
]; | ||
return _.map(baseMenuItems, (item) => ({ | ||
key: item.translationKey, | ||
title: translate(item.translationKey), | ||
icon: item.icon, | ||
iconRight: item.iconRight, | ||
onPress: item.action, | ||
shouldShowRightIcon: true, | ||
onSecondaryInteraction: !_.isEmpty(item.link) ? (e) => ReportActionContextMenu.showContextMenu(CONTEXT_MENU_TYPES.LINK, e, item.link, popoverAnchor) : undefined, | ||
ref: popoverAnchor, | ||
shouldBlockSelection: Boolean(item.link), | ||
})); | ||
}, [translate, waitForNavigate]); | ||
|
||
return ( | ||
<ScreenWrapper | ||
|
@@ -109,21 +121,10 @@ function AboutPage(props) { | |
<Text style={[styles.baseFontStyle, styles.mv5]}>{props.translate('initialSettingsPage.aboutPage.description')}</Text> | ||
</View> | ||
</View> | ||
{_.map(menuItems, (item) => ( | ||
<MenuItem | ||
key={item.translationKey} | ||
title={props.translate(item.translationKey)} | ||
icon={item.icon} | ||
iconRight={item.iconRight} | ||
onPress={() => item.action()} | ||
shouldBlockSelection={Boolean(item.link)} | ||
onSecondaryInteraction={ | ||
!_.isEmpty(item.link) ? (e) => ReportActionContextMenu.showContextMenu(CONTEXT_MENU_TYPES.LINK, e, item.link, popoverAnchor) : undefined | ||
} | ||
ref={(el) => (popoverAnchor = el)} | ||
shouldShowRightIcon | ||
/> | ||
))} | ||
<MenuItemList | ||
menuItems={menuItems} | ||
shouldUseSingleExecution | ||
/> | ||
</View> | ||
<View style={[styles.sidebarFooter]}> | ||
<Text | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
👋 coming from #30636
The hooks here cause an error in the storybook for component
HeaderWithBackButton
.