Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/components/EmojiPicker/EmojiPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useCallback, useEffect, useImperativeHandle, useRef, useState} from 'react';
import React, {Activity, useCallback, useEffect, useImperativeHandle, useRef, useState} from 'react';
import type {ForwardedRef, RefObject} from 'react';
import {Dimensions, View} from 'react-native';
import type {Emoji} from '@assets/emojis/types';
Expand Down Expand Up @@ -265,15 +265,17 @@ function EmojiPicker({viewportOffsetTop, ref}: EmojiPickerProps) {
shouldWrapModalChildrenInScrollViewIfBottomDockedInLandscapeMode={false}
>
<FocusTrapForModal active={isEmojiPickerVisible}>
<View>
<EmojiPickerMenu
onEmojiSelected={selectEmoji}
activeEmoji={activeEmoji.current}
ref={(el) => {
emojiSearchInput.current = el;
}}
/>
</View>
<Activity mode={isEmojiPickerVisible ? 'visible' : 'hidden'}>
<View>
<EmojiPickerMenu
onEmojiSelected={selectEmoji}
activeEmoji={activeEmoji.current}
ref={(el) => {
emojiSearchInput.current = el;
}}
/>
</View>
</Activity>
</FocusTrapForModal>
</PopoverWithMeasuredContent>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useIsFocused} from '@react-navigation/native';
import {accountIDSelector} from '@selectors/Session';
import React, {useCallback, useEffect, useMemo, useState} from 'react';
import React, {Activity, useCallback, useEffect, useMemo, useState} from 'react';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import AttachmentPicker from '@components/AttachmentPicker';
Expand Down Expand Up @@ -531,37 +531,39 @@ function AttachmentPickerWithMenuItems({
)}
</View>
</View>
<PopoverMenu
animationInTiming={menuItems.length * 50}
// The menu should close 2/3 of the time it took to open
animationOutTiming={menuItems.length * 50 * 0.66}
isVisible={isMenuVisible && isFocused}
onClose={onPopoverMenuClose}
onItemSelected={(item, index) => {
setMenuVisibility(false);
onItemSelected();

// In order for the file picker to open dynamically, the click
// function must be called from within a event handler that was initiated
// by the user on Safari.
if (index === menuItems.length - 1) {
if (isSafari()) {
triggerAttachmentPicker();
return;
<Activity mode={isMenuVisible && isFocused ? 'visible' : 'hidden'}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused regression. Composer menu gets reopened.

regression

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also caused another regression on iOS. Infinite loading on Add attachment > Choose from gallery

bug.mov

<PopoverMenu
animationInTiming={menuItems.length * 50}
// The menu should close 2/3 of the time it took to open
animationOutTiming={menuItems.length * 50 * 0.66}
isVisible={isMenuVisible && isFocused}
onClose={onPopoverMenuClose}
onItemSelected={(item, index) => {
setMenuVisibility(false);
onItemSelected();

// In order for the file picker to open dynamically, the click
// function must be called from within a event handler that was initiated
// by the user on Safari.
if (index === menuItems.length - 1) {
if (isSafari()) {
triggerAttachmentPicker();
return;
}
close(() => {
triggerAttachmentPicker();
});
}
close(() => {
triggerAttachmentPicker();
});
}
}}
anchorPosition={popoverAnchorPosition ?? {horizontal: 0, vertical: 0}}
anchorAlignment={{
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
}}
menuItems={menuItems}
anchorRef={actionButtonRef}
/>
}}
anchorPosition={popoverAnchorPosition ?? {horizontal: 0, vertical: 0}}
anchorAlignment={{
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
}}
menuItems={menuItems}
anchorRef={actionButtonRef}
/>
</Activity>
</>
);
}}
Expand Down
Loading