mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-08 22:33:24 +00:00
Remove findDOMNode as per warning
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import * as ModuleUtils from '../shipyard/ModuleUtils';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import TranslatedComponent from './TranslatedComponent';
|
||||
import { stopCtxPropagation } from '../utils/UtilityFunctions';
|
||||
import cn from 'classnames';
|
||||
@@ -374,7 +373,7 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
||||
*/
|
||||
componentDidMount() {
|
||||
if (this.groupElem) { // Scroll to currently selected group
|
||||
findDOMNode(this).scrollTop = this.groupElem.offsetTop;
|
||||
this.node.scrollTop = this.groupElem.offsetTop;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +392,7 @@ export default class AvailableModulesMenu extends TranslatedComponent {
|
||||
*/
|
||||
render() {
|
||||
return (
|
||||
<div
|
||||
<div ref={node => this.node = node}
|
||||
className={cn('select', this.props.className)}
|
||||
onScroll={this._hideDiff}
|
||||
onClick={(e) => e.stopPropagation() }
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import TranslatedComponent from './TranslatedComponent';
|
||||
|
||||
/**
|
||||
@@ -46,10 +45,9 @@ export default class ModalExport extends TranslatedComponent {
|
||||
* Focus on textarea and select all
|
||||
*/
|
||||
componentDidMount() {
|
||||
let e = findDOMNode(this.refs.exportField);
|
||||
if (e) {
|
||||
e.focus();
|
||||
e.select();
|
||||
if (this.exportField) {
|
||||
this.exportField.focus();
|
||||
this.exportField.select();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +67,7 @@ export default class ModalExport extends TranslatedComponent {
|
||||
<h2>{translate(this.props.title || 'Export')}</h2>
|
||||
{description}
|
||||
<div>
|
||||
<textarea className='cb json' ref='exportField' readOnly value={this.state.exportJson} />
|
||||
<textarea className='cb json' ref={node => this.exportField = node} readOnly value={this.state.exportJson} />
|
||||
</div>
|
||||
<button className='r dismiss cap' onClick={this.context.hideModal}>{translate('close')}</button>
|
||||
</div>;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* eslint react/no-danger: 0 */
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import TranslatedComponent from './TranslatedComponent';
|
||||
|
||||
/**
|
||||
@@ -21,17 +20,6 @@ export default class ModalHelp extends TranslatedComponent {
|
||||
super(props);
|
||||
}
|
||||
|
||||
/**
|
||||
* Focus on textarea and select all
|
||||
*/
|
||||
componentDidMount() {
|
||||
const e = findDOMNode(this.refs.exportField);
|
||||
if (e) {
|
||||
e.focus();
|
||||
e.select();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the modal
|
||||
* @return {React.Component} Modal Content
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import cn from 'classnames';
|
||||
import TranslatedComponent from './TranslatedComponent';
|
||||
import PowerBands from './PowerBands';
|
||||
@@ -149,7 +148,7 @@ export default class PowerManagement extends TranslatedComponent {
|
||||
* Update power bands width from DOM
|
||||
*/
|
||||
_updateWidth() {
|
||||
this.setState({ width: findDOMNode(this).offsetWidth });
|
||||
this.setState({ width: this.node.offsetWidth });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,7 +196,7 @@ export default class PowerManagement extends TranslatedComponent {
|
||||
let sortOrder = this._sortOrder;
|
||||
|
||||
return (
|
||||
<div className='group half' id='componentPriority'>
|
||||
<div ref={node => this.node = node} className='group half' id='componentPriority'>
|
||||
<table style={{ width: '100%' }}>
|
||||
<thead>
|
||||
<tr className='main'>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import Page from './Page';
|
||||
import Router from '../Router';
|
||||
import cn from 'classnames';
|
||||
@@ -385,7 +384,7 @@ export default class ComparisonPage extends Page {
|
||||
*/
|
||||
_updateDimensions() {
|
||||
this.setState({
|
||||
chartWidth: findDOMNode(this.refs.chartRef).offsetWidth
|
||||
chartWidth: this.chartRef.offsetWidth
|
||||
});
|
||||
}
|
||||
|
||||
@@ -500,9 +499,9 @@ export default class ComparisonPage extends Page {
|
||||
<ComparisonTable builds={builds} facets={facets} onSort={this._sortShips} predicate={predicate} desc={desc} />
|
||||
|
||||
{!builds.length ?
|
||||
<div className='chart' ref={'chartRef'}>{translate('PHRASE_NO_BUILDS')}</div> :
|
||||
<div className='chart' ref={node => this.chartRef = node}>{translate('PHRASE_NO_BUILDS')}</div> :
|
||||
facets.filter((f) => f.active).map((f, i) =>
|
||||
<div key={f.title} className='chart' ref={ i == 0 ? 'chartRef' : null}>
|
||||
<div key={f.title} className='chart' ref={ i == 0 ? node => this.chartRef = node : null}>
|
||||
<h3 className='ptr' onClick={this._sortShips.bind(this, f.props[0])}>{translate(f.title)}</h3>
|
||||
<BarChart
|
||||
width={chartWidth}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
// import Perf from 'react-addons-perf';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import { Ships } from 'coriolis-data/dist';
|
||||
import cn from 'classnames';
|
||||
import Page from './Page';
|
||||
|
||||
Reference in New Issue
Block a user