Skip to content

Commit 412484a

Browse files
author
Christoph Pader
committed
apply changes from Expensify#19011
1 parent 160e0eb commit 412484a

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

src/pages/home/report/ReportActionCompose.js

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,16 @@ function ReportActionCompose({
10491049
runOnJS(submitForm)();
10501050
});
10511051

1052+
const menuItems = [
1053+
...moneyRequestOptions,
1054+
...taskOption,
1055+
{
1056+
icon: Expensicons.Paperclip,
1057+
text: translate('reportActionCompose.addAttachment'),
1058+
onSelected: () => {},
1059+
},
1060+
];
1061+
10521062
return (
10531063
<View style={[shouldShowReportRecipientLocalTime && !lodashGet(network, 'isOffline') && styles.chatItemComposeWithFirstRow, isComposerFullSize && styles.chatItemFullComposeRow]}>
10541064
<OfflineWithFeedback
@@ -1130,7 +1140,7 @@ function ReportActionCompose({
11301140

11311141
// Drop focus to avoid blue focus ring.
11321142
actionButton.current.blur();
1133-
setMenuVisibility(true);
1143+
setMenuVisibility(!isMenuVisible);
11341144
}}
11351145
style={styles.composerSizeButton}
11361146
disabled={isBlockedFromConcierge || disabled}
@@ -1145,7 +1155,24 @@ function ReportActionCompose({
11451155
animationInTiming={CONST.ANIMATION_IN_TIMING}
11461156
isVisible={isMenuVisible}
11471157
onClose={() => setMenuVisibility(false)}
1148-
onItemSelected={() => setMenuVisibility(false)}
1158+
onItemSelected={(_item, index) => {
1159+
setMenuVisibility(false);
1160+
1161+
// In order for the file picker to open dynamically, the click
1162+
// function must be called from within a event handler that was initiated
1163+
// by the user.
1164+
if (index === menuItems.length - 1) {
1165+
// Set a flag to block suggestion calculation until we're finished using the file picker,
1166+
// which will stop any flickering as the file picker opens on non-native devices.
1167+
if (willBlurTextInputOnTapOutside) {
1168+
shouldBlockEmojiCalc.current = true;
1169+
shouldBlockMentionCalc.current = true;
1170+
}
1171+
openPicker({
1172+
onPicked: displayFileInModal,
1173+
});
1174+
}
1175+
}}
11491176
anchorPosition={styles.createMenuPositionReportActionCompose(windowHeight)}
11501177
anchorAlignment={{horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM}}
11511178
menuItems={[
@@ -1168,6 +1195,8 @@ function ReportActionCompose({
11681195
},
11691196
},
11701197
]}
1198+
withoutOverlay
1199+
anchorRef={actionButton}
11711200
/>
11721201
</>
11731202
)}

0 commit comments

Comments
 (0)