Skip to content

Commit

Permalink
Migrate headerOverlay string ref to functional ones in channel_info_b…
Browse files Browse the repository at this point in the history
…utton.js (mattermost#6661)

Automatic Merge
  • Loading branch information
sowmiyamuthuraman committed Oct 20, 2020
1 parent f2ec100 commit fbc5157
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
/* eslint-disable react/no-string-refs */

import PropTypes from 'prop-types';
import React from 'react';
Expand All @@ -27,6 +26,8 @@ export default class NavbarInfoButton extends React.PureComponent {
}).isRequired,
};

headerOverlayRef = React.createRef();

componentDidUpdate(prevProps) {
const RHSChanged = !prevProps.isRHSOpen && this.props.isRHSOpen;
const channelChanged = prevProps.channel?.id !== this.props.channel?.id;
Expand All @@ -49,8 +50,8 @@ export default class NavbarInfoButton extends React.PureComponent {
}

hide = () => {
if (this.refs.headerOverlay) {
this.refs.headerOverlay.hide();
if (this.headerOverlayRef.current) {
this.headerOverlayRef.current.hide();
}
}

Expand Down Expand Up @@ -128,7 +129,7 @@ export default class NavbarInfoButton extends React.PureComponent {

return (
<OverlayTrigger
ref='headerOverlay'
ref={this.headerOverlayRef}
trigger='click'
placement='bottom'
overlay={popover}
Expand All @@ -148,4 +149,3 @@ export default class NavbarInfoButton extends React.PureComponent {
);
}
}
/* eslint-enable react/no-string-refs */

0 comments on commit fbc5157

Please sign in to comment.