-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathindex.js
26 lines (23 loc) · 1012 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import React from 'react';
import {propTypes, defaultProps} from './PopoverPropTypes';
import CONST from '../../CONST';
import Modal from '../Modal';
import withWindowDimensions from '../withWindowDimensions';
/*
* 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={props.isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.POPOVER}
popoverAnchorPosition={props.anchorPosition}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
animationIn={props.isSmallScreenWidth ? undefined : props.animationIn}
animationOut={props.isSmallScreenWidth ? undefined : props.animationOut}
/>
);
Popover.propTypes = propTypes;
Popover.defaultProps = defaultProps;
Popover.displayName = 'Popover';
export default withWindowDimensions(Popover);