Skip to content

Commit

Permalink
revert findDOMNode() deletion and use cli feature/enact_v5 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
hong6316 committed May 29, 2024
1 parent b0717f0 commit 7298d70
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ before_install:
install:
- npm config set prefer-offline false
- npm install -g codecov
- git clone --branch=feature/WRQ-21653 --depth 1 https://github.com/enactjs/cli ../cli
- git clone --branch=feature/enact_v5 --depth 1 https://github.com/enactjs/cli ../cli
- pushd ../cli
- npm install --force
- npm link
Expand Down
3 changes: 3 additions & 0 deletions packages/spotlight/Spottable/Spottable.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import EnactPropTypes from '@enact/core/internal/prop-types';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import {Component} from 'react';
import ReactDOM from 'react-dom';

import {spottableClass, useSpottable} from './useSpottable';

Expand Down Expand Up @@ -267,6 +268,8 @@ const Spottable = hoc(defaultConfig, (config, Wrapped) => {
// eslint-disable-next-line no-shadow
class Spottable extends Component {
componentDidMount () {
// eslint-disable-next-line react/no-find-dom-node
this.node = ReactDOM.findDOMNode(this);
this.forceUpdate();
}

Expand Down
3 changes: 3 additions & 0 deletions packages/spotlight/Spottable/tests/useSpot-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import '@testing-library/jest-dom';
import {fireEvent, render, screen} from '@testing-library/react';
import classNames from 'classnames';
import {Component} from 'react';
import ReactDOM from 'react-dom';

import Spotlight from '../../src/spotlight.js';
import useSpottable from '../useSpottable';
Expand Down Expand Up @@ -83,6 +84,8 @@ describe('useSpottable', () => {

class SpottableComponent extends Component {
componentDidMount () {
// eslint-disable-next-line react/no-find-dom-node
this.node = ReactDOM.findDOMNode(this);
}

get componentRef () {
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/Placeholder/PlaceholderControllerDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import hoc from '@enact/core/hoc';
import {Job} from '@enact/core/util';
import Registry from '@enact/core/internal/Registry';
import {createContext, Component} from 'react';
import ReactDOM from 'react-dom';

/**
* Default config for `PlaceholderControllerDecorator`.
Expand Down Expand Up @@ -84,6 +85,8 @@ const PlaceholderControllerDecorator = hoc(defaultConfig, (config, Wrapped) => {
this.bounds = Object.assign({}, bounds);
} else {
// Allowing findDOMNode for HOCs versus adding extra ref props
// eslint-disable-next-line react/no-find-dom-node
this.node = ReactDOM.findDOMNode(this);
this.bounds = {
height: this.node.offsetHeight,
width: this.node.offsetWidth
Expand Down
5 changes: 3 additions & 2 deletions packages/ui/Scrollable/Scrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import classNames from 'classnames';
import {Job} from '@enact/core/util';
import PropTypes from 'prop-types';
import {createRef, PureComponent, Component} from 'react';
import ReactDOM from 'react-dom';

import ri from '../resolution';

Expand All @@ -22,8 +23,8 @@ const
* @param {String} variable - CSS Variable property.
* @param {String} value - CSS Variable value.
*/
const setCSSVariable = (element, variable, value) => { // eslint-disable-line no-unused-vars
// ReactDOM.findDOMNode(element).style.setProperty(variable, value); // eslint-disable-line react/no-find-dom-node
const setCSSVariable = (element, variable, value) => {
ReactDOM.findDOMNode(element).style.setProperty(variable, value); // eslint-disable-line react/no-find-dom-node
};

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/ViewManager/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import {Job} from '@enact/core/util';
import {cloneElement, Children, Component} from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';

import {shape} from './Arranger';

Expand Down Expand Up @@ -258,6 +259,8 @@ class View extends Component {

// Need to ensure that we have a valid node reference before we animation. Sometimes, React
// will replace the node after mount causing a reference cached there to be invalid.
// eslint-disable-next-line react/no-find-dom-node
this.node = ReactDOM.findDOMNode(this);

if (this.animation && this.animation.playState !== 'finished' && this.changeDirection) {
this.animation.reverse();
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/resolution/ResolutionDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import {Component} from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import hoc from '@enact/core/hoc';

Expand Down Expand Up @@ -111,6 +112,8 @@ const ResolutionDecorator = hoc(defaultConfig, (config, Wrapped) => {

componentDidMount () {
if (config.dynamic) window.addEventListener('resize', this.handleResize);
// eslint-disable-next-line react/no-find-dom-node
this.rootNode = ReactDOM.findDOMNode(this);
}

componentWillUnmount () {
Expand Down

0 comments on commit 7298d70

Please sign in to comment.