Skip to content
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

fix menu placement is broken on mobile #3635

Merged
merged 4 commits into from
Jun 18, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/components/Modal/index.ios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import withWindowDimensions from '../withWindowDimensions';
import BaseModal from './BaseModal';
import {propTypes, defaultProps} from './ModalPropTypes';

const Modal = props => (
<BaseModal
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
>
{props.children}
</BaseModal>
);

Modal.propTypes = propTypes;
Modal.defaultProps = defaultProps;
Modal.displayName = 'Modal';
export default withWindowDimensions(Modal);
1 change: 1 addition & 0 deletions src/components/Popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const Popover = (props) => {
popoverAnchorPosition={props.isSmallScreenWidth ? undefined : props.anchorPosition}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
fullscreen={props.isSmallScreenWidth ? true : props.fullscreen}
animationIn={props.isSmallScreenWidth ? undefined : props.animationIn}
animationOut={props.isSmallScreenWidth ? undefined : props.animationOut}
/>
Expand Down
32 changes: 32 additions & 0 deletions src/components/Popover/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import _ from 'underscore';
import React from 'react';
import {propTypes as popoverPropTypes, defaultProps} from './PopoverPropTypes';
import CONST from '../../CONST';
import Modal from '../Modal';
import {windowDimensionsPropTypes} from '../withWindowDimensions';

const propTypes = {
...(_.omit(popoverPropTypes, _.keys(windowDimensionsPropTypes))),
};

/*
* 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.
*/
const Popover = props => (
<Modal
type={CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}

// Mobile will always has fullscreen menu
// eslint-disable-next-line react/jsx-props-no-multi-spaces
fullscreen
/>
);

Popover.propTypes = propTypes;
Popover.defaultProps = defaultProps;
Popover.displayName = 'Popover';

export default Popover;