react-sortable-tree icon indicating copy to clipboard operation
react-sortable-tree copied to clipboard

react-sortable-tree not working on react 17.0.1

Open AliTaee opened this issue 3 years ago • 5 comments

I'm using the example of react-sortable-tree but it's not working on react 17.

When I'm using react 16.14.0, it has no error and working fine.

List of Errors:

  • Unable to find node on an unmounted component. at findHostInstanceWithWarning
  • Uncaught TypeError: this.clearMonitorSubscription is not a function at ScrollingComponent.componentWillUnmount
  • The above error occurred in the <Scrolling(List)> component:
import React from 'react'
import 'react-sortable-tree/style.css'
import SortableTree from 'react-sortable-tree'
class Areas extends React.Component {
  constructor(props) {
    super(props)

    this.state = {
      treeData: [
        { title: 'Chicken', children: [{ title: 'Egg' }] },
        { title: 'Fish', children: [{ title: 'fingerline' }] }
      ]
    }
  }

  render() {
    return (
      <div style={{ height: 400 }}>
        <SortableTree
          treeData={this.state.treeData}
          onChange={treeData => this.setState({ treeData })}
        />
      </div>
    )
  }
}

AliTaee avatar Dec 07 '20 11:12 AliTaee

+https://github.com/frontend-collective/react-sortable-tree/issues/821

deser avatar Dec 09 '20 07:12 deser

Not sure if this package is abandoned, but there's a fork on NPM that's updated for React 17: https://www.npmjs.com/package/react-sortable-tree-patch-react-17

arcataroger avatar Jun 18 '21 17:06 arcataroger

Hi guys,

I fixed the issues with React 17 and created a separate package.

You can install it using

yarn add @nosferatu500/react-sortable-tree

But it does not include types for typescript. you can workaround with it:

  • create decs.d.ts file and place it with tsconfig.json
  • add declare module @nosferatu500/react-sortable-tree to decs.d.ts file
  • in tsconfig.json change
"include": [
  "src"
  ]

to

"include": [
  "src",
  "decs.d.ts"
  ]

I am not planning any new features or any other updates (only bug fixes and only if it block my own work), but if you want to improve something, you can send me the PR to me https://github.com/nosferatu500/react-sortable-tree and I will merge it.

nosferatu500 avatar Jun 23 '21 02:06 nosferatu500

Hi guys,

I fixed the issues with React 17 and created a separate package.

You can install it using

yarn add @nosferatu500/react-sortable-tree

But it does not include types for typescript. you can workaround with it:

  • create decs.d.ts file and place it with tsconfig.json
  • add declare module @nosferatu500/react-sortable-tree to decs.d.ts file
  • in tsconfig.json change
"include": [
  "src"
  ]

to

"include": [
  "src",
  "decs.d.ts"
  ]

I am not planning any new features or any other updates (only bug fixes and only if it block my own work), but if you want to improve something, you can send me the PR to me https://github.com/nosferatu500/react-sortable-tree and I will merge it.

Actually, it's not a good solution. We need to communicate with the authors of the react-sortable-tree to fix it in the original version.

balovbohdan avatar Jan 04 '22 15:01 balovbohdan

@balovbohdan Have you gotten any response from the authors? I haven't seen any.

NickEmpetvee avatar Apr 13 '22 20:04 NickEmpetvee