Skip to content

Commit

Permalink
fix perf-test
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Sep 27, 2024
1 parent 1e8b7ce commit b326494
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/components/PopoverMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ PopoverMenu.displayName = 'PopoverMenu';
export default React.memo(
PopoverMenu,
(prevProps, nextProps) =>
lodashIsEqual(prevProps.menuItems, nextProps.menuItems) &&
lodashIsEqual(prevProps.menuItems.length, nextProps.menuItems.length) &&
prevProps.isVisible === nextProps.isVisible &&
lodashIsEqual(prevProps.anchorPosition, nextProps.anchorPosition) &&
prevProps.anchorRef === nextProps.anchorRef &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,27 @@ function AttachmentPickerWithMenuItems({
setMenuVisibility(false);
}, [didScreenBecomeInactive, isMenuVisible, setMenuVisibility]);

const getMenuItems = useCallback(
(triggerAttachmentPicker: () => void) => {
return [
...moneyRequestOptions,
...taskOption,
{
icon: Expensicons.Paperclip,
text: translate('reportActionCompose.addAttachment'),
onSelected: () => {
if (Browser.isSafari()) {
return;
}
triggerAttachmentPicker();
},
shouldCallAfterModalHide: true,
},
];
},
[moneyRequestOptions, taskOption, translate],
);

return (
<AttachmentPicker>
{({openPicker}) => {
Expand All @@ -223,21 +244,7 @@ function AttachmentPickerWithMenuItems({
onCanceled: onCanceledAttachmentPicker,
});
};
const menuItems = [
...moneyRequestOptions,
...taskOption,
{
icon: Expensicons.Paperclip,
text: translate('reportActionCompose.addAttachment'),
onSelected: () => {
if (Browser.isSafari()) {
return;
}
triggerAttachmentPicker();
},
shouldCallAfterModalHide: true,
},
];
const menuItems = getMenuItems(triggerAttachmentPicker);
return (
<>
<View style={[styles.dFlex, styles.flexColumn, isFullComposerAvailable || isComposerFullSize ? styles.justifyContentBetween : styles.justifyContentCenter]}>
Expand Down

0 comments on commit b326494

Please sign in to comment.