Skip to content

Commit

Permalink
Fix v16 HOC ref pass through
Browse files Browse the repository at this point in the history
  • Loading branch information
jonambas committed Oct 17, 2017
1 parent a335422 commit c49294d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/components/Tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export class Tooltip extends Component {
right,
horizontalOffset,
preferredPosition,
forcePosition
forcePosition,
positionRef
} = this.props;

const positionTop = preferredPosition.top || (top && !forcePosition);
Expand All @@ -77,7 +78,7 @@ export class Tooltip extends Component {
const offset = positionRight ? { right: horizontalOffset } : { left: horizontalOffset };

return (
<span className={wrapperClasses}>
<span className={wrapperClasses} ref={positionRef}>
{ children }
<span className={styles.Tooltip} style={offset}>
<span className={styles.Tip} />
Expand Down
5 changes: 2 additions & 3 deletions src/components/WithPositioning/withPositioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ function withPositioning(WrappedComponent) {
render() {
return (
<WrappedComponent
ref={(node) => this.component = node}
positionRef={(node) => this.component = node}
preferredPosition={this.state.preferredPosition}
{...this.props}
/>
{...this.props} />
);
}
}
Expand Down

0 comments on commit c49294d

Please sign in to comment.