@@ -180,19 +180,20 @@ class ListWrapper extends Component {
180
180
height : 600 ,
181
181
} ;
182
182
183
- onSortStart = ( ... args ) => {
183
+ onSortStart = ( event ) => {
184
184
const { onSortStart} = this . props ;
185
185
this . setState ( { isSorting : true } ) ;
186
186
187
187
document . body . style . cursor = 'grabbing' ;
188
188
189
189
if ( onSortStart ) {
190
- onSortStart ( this . refs . component , ... args ) ;
190
+ onSortStart ( event , this . refs . component ) ;
191
191
}
192
192
} ;
193
193
194
- onSortEnd = ( { oldIndex , newIndex } ) => {
194
+ onSortEnd = ( event ) => {
195
195
const { onSortEnd} = this . props ;
196
+ const { oldIndex, newIndex} = event ;
196
197
const { items} = this . state ;
197
198
198
199
this . setState ( {
@@ -203,7 +204,7 @@ class ListWrapper extends Component {
203
204
document . body . style . cursor = '' ;
204
205
205
206
if ( onSortEnd ) {
206
- onSortEnd ( this . refs . component ) ;
207
+ onSortEnd ( event , this . refs . component ) ;
207
208
}
208
209
} ;
209
210
@@ -556,7 +557,7 @@ storiesOf('General | Layout / Grid', module)
556
557
style . gridItem ,
557
558
style . gridItemVariableSized ,
558
559
) }
559
- onSortStart = { ( _ , { node} , event ) => {
560
+ onSortStart = { ( { node} , event ) => {
560
561
const boundingClientRect = node . getBoundingClientRect ( ) ;
561
562
562
563
transformOrigin . x =
@@ -581,19 +582,21 @@ storiesOf('General | Layout / Grid', module)
581
582
finalNodes . forEach ( ( { node} , i ) => {
582
583
const oldNode = nodes [ i ] . node ;
583
584
const scale = oldNode . offsetWidth / node . offsetWidth ;
584
- const wrapperNode = node . childNodes [ 0 ] ;
585
+ const wrapperNode = node . querySelector ( `. ${ style . wrapper } ` ) ;
585
586
586
587
wrapperNode . style . transform = `scale(${ scale } )` ;
587
588
wrapperNode . style . transformOrigin =
588
589
newIndex > i ? '0 0' : '100% 0' ;
589
590
} ) ;
590
591
} }
591
- onSortEnd = { ( ) => {
592
- [ ...document . querySelectorAll ( `.${ style . wrapper } ` ) ] . forEach (
593
- ( node ) => {
594
- node . style . transform = '' ;
595
- } ,
596
- ) ;
592
+ onSortEnd = { ( { nodes} ) => {
593
+ console . log ( nodes ) ;
594
+
595
+ nodes . forEach ( ( { node} ) => {
596
+ const wrapperNode = node . querySelector ( `.${ style . wrapper } ` ) ;
597
+
598
+ wrapperNode . style . transform = '' ;
599
+ } ) ;
597
600
} }
598
601
/>
599
602
</ div >
@@ -762,7 +765,7 @@ storiesOf('Advanced examples | Virtualization libraries / react-window', module)
762
765
items = { getItems ( 500 , 59 ) }
763
766
itemHeight = { 59 }
764
767
helperClass = { style . stylizedHelper }
765
- onSortEnd = { ( ref ) => {
768
+ onSortEnd = { ( _ , ref ) => {
766
769
// We need to inform React Window that the order of the items has changed
767
770
const instance = ref . getWrappedInstance ( ) ;
768
771
const list = instance . refs . VirtualList ;
@@ -780,7 +783,7 @@ storiesOf('Advanced examples | Virtualization libraries / react-window', module)
780
783
component = { SortableReactWindow ( VariableSizeList ) }
781
784
items = { getItems ( 500 ) }
782
785
helperClass = { style . stylizedHelper }
783
- onSortEnd = { ( ref ) => {
786
+ onSortEnd = { ( _ , ref ) => {
784
787
// We need to inform React Window that the item heights have changed
785
788
const instance = ref . getWrappedInstance ( ) ;
786
789
const list = instance . refs . VirtualList ;
@@ -816,7 +819,7 @@ storiesOf(
816
819
items = { getItems ( 500 ) }
817
820
itemHeight = { 89 }
818
821
helperClass = { style . stylizedHelper }
819
- onSortEnd = { ( ref ) => {
822
+ onSortEnd = { ( _ , ref ) => {
820
823
// We need to inform React Virtualized that the item heights have changed
821
824
const instance = ref . getWrappedInstance ( ) ;
822
825
const list = instance . refs . VirtualList ;
0 commit comments