Skip to content

[UX Reliability] Add new modal for components using Popover #61165

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

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 0 additions & 1 deletion src/components/DatePicker/DatePickerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ function DatePickerModal({
shouldSwitchPositionIfOverflow
shouldEnableNewFocusManagement
shouldMeasureAnchorPositionFromTop={shouldPositionFromTop}
shouldUseNewModal
>
<CalendarPicker
minDate={minDate}
Expand Down
1 change: 0 additions & 1 deletion src/components/EmojiPicker/EmojiPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ function EmojiPicker({viewportOffsetTop}: EmojiPickerProps, ref: ForwardedRef<Em
shouldSwitchPositionIfOverflow
shouldEnableNewFocusManagement
restoreFocusType={CONST.MODAL.RESTORE_FOCUS_TYPE.DELETE}
shouldUseNewModal
>
<FocusTrapForModal active={isEmojiPickerVisible}>
<View>
Expand Down
12 changes: 11 additions & 1 deletion src/components/Popover/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@ import type PopoverProps from './types';
* This is a convenience wrapper around the Modal component for a responsive Popover.
* On small screen widths, it uses BottomDocked modal type, and a Popover type on wide screen widths.
*/
function Popover({animationIn, animationOut, popoverAnchorPosition, disableAnimation, anchorPosition = {}, fromSidebarMediumScreen, ...propsWithoutAnimation}: PopoverProps) {
function Popover({
animationIn,
animationOut,
popoverAnchorPosition,
disableAnimation,
anchorPosition = {},
fromSidebarMediumScreen,
shouldUseNewModal = true,
...propsWithoutAnimation
}: PopoverProps) {
return (
<Modal
type={fromSidebarMediumScreen ? CONST.MODAL.MODAL_TYPE.POPOVER : CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED}
popoverAnchorPosition={fromSidebarMediumScreen ? anchorPosition : undefined}
// eslint-disable-next-line react/jsx-props-no-spreading
{...propsWithoutAnimation}
shouldUseNewModal={shouldUseNewModal}
// Mobile will always has fullscreen menu
fullscreen
animationIn="slideInUp"
Expand Down
3 changes: 3 additions & 0 deletions src/components/Popover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function Popover(props: PopoverProps) {
animationIn = 'fadeIn',
animationOut = 'fadeOut',
shouldCloseWhenBrowserNavigationChanged = true,
shouldUseNewModal = true,
} = props;

// We need to use isSmallScreenWidth to apply the correct modal type and popoverAnchorPosition
Expand Down Expand Up @@ -76,6 +77,7 @@ function Popover(props: PopoverProps) {
onLayout={onLayout}
animationIn={animationIn}
animationOut={animationOut}
shouldUseNewModal={shouldUseNewModal}
/>,
document.body,
);
Expand Down Expand Up @@ -108,6 +110,7 @@ function Popover(props: PopoverProps) {
onLayout={onLayout}
animationIn={animationIn}
animationOut={animationOut}
shouldUseNewModal={shouldUseNewModal}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/PopoverMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function PopoverMenu({
shouldEnableMaxHeight = true,
shouldUpdateFocusedIndex = true,
shouldUseModalPaddingStyle,
shouldUseNewModal,
shouldUseNewModal = true,
shouldAvoidSafariException = false,
testID,
}: PopoverMenuProps) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/PopoverWithMeasuredContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function PopoverWithMeasuredContent({
shouldHandleNavigationBack = false,
shouldEnableNewFocusManagement,
shouldMeasureAnchorPositionFromTop = false,
shouldUseNewModal = false,
shouldUseNewModal = true,
...props
}: PopoverWithMeasuredContentProps) {
const styles = useThemeStyles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
anchorDimensions={contextMenuDimensions.current}
anchorRef={anchorRef}
shouldSwitchPositionIfOverflow={shouldSwitchPositionIfOverflow}
shouldUseNewModal
>
<BaseReportActionContextMenu
isVisible={isPopoverVisible}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function BasePopoverReactionList({emojiName, reportActionID, currentUserPersonal
fullscreen
withoutOverlay
anchorRef={reactionListRef}
shouldUseNewModal
>
<BaseReactionList
isVisible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,6 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
fromSidebarMediumScreen={!shouldUseNarrowLayout}
animationInTiming={CONST.MODAL.ANIMATION_TIMING.FAB_IN}
animationOutTiming={CONST.MODAL.ANIMATION_TIMING.FAB_OUT}
shouldUseNewModal
menuItems={menuItems.map((item) => {
return {
...item,
Expand Down
5 changes: 5 additions & 0 deletions tests/perf-test/ReportActionCompose.perf-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jest.mock('@gorhom/portal');
jest.mock('react-native-reanimated', () => ({
...jest.requireActual<typeof Animated>('react-native-reanimated/mock'),
useAnimatedRef: jest.fn(),

LayoutAnimationConfig: () => {
// eslint-disable-next-line react/jsx-no-useless-fragment
return ({children}: {children: React.ReactNode}) => <>{children}</>;
},
}));

jest.mock('../../src/libs/Navigation/Navigation', () => ({
Expand Down