remove deprecated findDOMNode
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// Context Menu: popup/dropdown menu.
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { injectIntl, defineMessages } from 'react-intl';
|
||||
|
||||
import { REM_SIZE } from '../config.js';
|
||||
@@ -109,6 +108,8 @@ class ContextMenu extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.selfRef = React.createRef();
|
||||
|
||||
const {formatMessage} = props.intl;
|
||||
|
||||
this.handlePageClick = this.handlePageClick.bind(this);
|
||||
@@ -318,7 +319,7 @@ class ContextMenu extends React.Component {
|
||||
}
|
||||
|
||||
handlePageClick(e) {
|
||||
if (ReactDOM.findDOMNode(this).contains(e.target)) {
|
||||
if (this.selfRef.contains(e.target)) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
@@ -445,7 +446,7 @@ class ContextMenu extends React.Component {
|
||||
};
|
||||
|
||||
return (
|
||||
<ul className="menu" style={position}>
|
||||
<ul className="menu" style={position} ref={this.selfRef}>
|
||||
{menu}
|
||||
</ul>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user