File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint consistent-return: 0 */
2
2
import PropTypes from 'prop-types' ;
3
3
import React , { Component } from 'react' ;
4
- import ReactDOM from 'react-dom' ;
5
4
import SortableJS from 'sortablejs' ;
6
5
7
6
const store = {
@@ -19,11 +18,13 @@ class Sortable extends Component {
19
18
] ) ,
20
19
style : PropTypes . object
21
20
} ;
21
+
22
22
static defaultProps = {
23
23
options : { } ,
24
24
tag : 'div' ,
25
25
style : { }
26
26
} ;
27
+
27
28
sortable = null ;
28
29
29
30
componentDidMount ( ) {
@@ -84,20 +85,29 @@ class Sortable extends Component {
84
85
85
86
this . sortable = SortableJS . create ( this . node , options ) ;
86
87
}
88
+
87
89
componentWillUnmount ( ) {
88
90
if ( this . sortable ) {
89
91
this . sortable . destroy ( ) ;
90
92
this . sortable = null ;
91
93
}
92
94
}
93
- render ( ) {
94
- const { tag : Component , ...props } = this . props ;
95
95
96
- delete props . options ;
97
- delete props . onChange ;
96
+ render ( ) {
97
+ const {
98
+ tag : Component ,
99
+ options, // eslint-disable-line
100
+ onChange, // eslint-disable-line
101
+ ...props
102
+ } = this . props ;
98
103
99
104
return (
100
- < Component { ...props } ref = { ( node ) => { return this . node = node ; } } />
105
+ < Component
106
+ { ...props }
107
+ ref = { node => {
108
+ this . node = node ;
109
+ } }
110
+ />
101
111
) ;
102
112
}
103
113
}
You can’t perform that action at this time.
0 commit comments