Skip to content

Commit

Permalink
Merge pull request #35601 from ishpaul777/fix/35310
Browse files Browse the repository at this point in the history
fixes crash on long press expensify classic option
  • Loading branch information
nkuoch authored Feb 5, 2024
2 parents d765c37 + ff3aee9 commit b2c3100
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/pages/settings/InitialSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function InitialSettingsPage(props) {
action: () => {
Link.openOldDotLink(CONST.OLDDOT_URLS.INBOX);
},
link: Link.buildOldDotURL(CONST.OLDDOT_URLS.INBOX),
link: () => Link.buildOldDotURL(CONST.OLDDOT_URLS.INBOX),
},
{
translationKey: 'initialSettingsPage.signOut',
Expand Down Expand Up @@ -225,6 +225,15 @@ function InitialSettingsPage(props) {
* @returns {String|undefined} the user's wallet balance
*/
const getWalletBalance = (isPaymentItem) => (isPaymentItem ? CurrencyUtils.convertToDisplayString(props.userWallet.currentBalance) : undefined);

const openPopover = (link, event) => {
if (typeof link === 'function') {
link().then((url) => ReportActionContextMenu.showContextMenu(CONST.CONTEXT_MENU_TYPES.LINK, event, url, popoverAnchor.current));
} else if (link) {
ReportActionContextMenu.showContextMenu(CONST.CONTEXT_MENU_TYPES.LINK, event, link, popoverAnchor.current);
}
};

return (
<View style={[menuItemsData.sectionStyle, styles.pb4, styles.mh3]}>
<Text style={styles.sectionTitle}>{translate(menuItemsData.sectionTranslationKey)}</Text>
Expand Down Expand Up @@ -259,9 +268,7 @@ function InitialSettingsPage(props) {
ref={popoverAnchor}
hoverAndPressStyle={styles.hoveredComponentBG}
shouldBlockSelection={Boolean(item.link)}
onSecondaryInteraction={
!_.isEmpty(item.link) ? (e) => ReportActionContextMenu.showContextMenu(CONST.CONTEXT_MENU_TYPES.LINK, e, item.link, popoverAnchor.current) : undefined
}
onSecondaryInteraction={item.link ? (event) => openPopover(item.link, event) : undefined}
focused={activeRoute && item.routeName && activeRoute.toLowerCase().replaceAll('_', '') === item.routeName.toLowerCase().replaceAll('/', '')}
isPaneMenu
/>
Expand Down

0 comments on commit b2c3100

Please sign in to comment.