Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Commit

Permalink
feat(PopOver): Expose popover ref
Browse files Browse the repository at this point in the history
  • Loading branch information
diondiondion committed Oct 1, 2019
1 parent ef067d2 commit 1d8353e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/PopOver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function PopOver(props) {
isOpen,
offset,
placement,
popOverRef,
positionFixed,
referenceRef,
renderer: PopOverRenderer,
} = props;

Expand All @@ -38,8 +40,11 @@ function PopOver(props) {

return (
<Manager>
<Reference innerRef={innerRef}>{children}</Reference>
<Reference innerRef={referenceRef || innerRef}>
{children}
</Reference>
<Popper
innerRef={popOverRef}
positionFixed={positionFixed}
placement={placement}
modifiers={{
Expand Down Expand Up @@ -129,16 +134,18 @@ PopOver.propTypes = {
content: PropTypes.node,
/** Control the popover's distance from its reference element */
distance: PropTypes.number,
/** Access the reference component's ref */
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
/** Control whether the popover is shown or not */
isOpen: PropTypes.bool,
/** Shift the popover along the corss-axix */
offset: PropTypes.number,
/** One of 'top', 'bottom', 'left', or 'right'. Add an optional suffix '-start' or '-end' to align the popover to the start or end of the chosen direction. */
placement: PropTypes.oneOf(placements),
/** Access the popover's element */
popOverRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
/** Control whether the popover should be positioned using "position: absolute" or "position: fixed" */
positionFixed: PropTypes.bool,
/** Access the reference component's element */
referenceRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
/**
* Customise popover rendering (e.g. for custom styling, transitions, etc).
* Should be a React component that takes the props
Expand Down

0 comments on commit 1d8353e

Please sign in to comment.