react-sortable-tree
react-sortable-tree copied to clipboard
react-sortable-tree not working on react 17.0.1
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>
)
}
}
+https://github.com/frontend-collective/react-sortable-tree/issues/821
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
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 withtsconfig.json
- add
declare module @nosferatu500/react-sortable-tree
todecs.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.
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 withtsconfig.json
- add
declare module @nosferatu500/react-sortable-tree
todecs.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 Have you gotten any response from the authors? I haven't seen any.