-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3635 from parasharrajat/context-menu
fix menu placement is broken on mobile
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |