@@ -180,19 +180,20 @@ class ListWrapper extends Component {
180180 height : 600 ,
181181 } ;
182182
183- onSortStart = ( ... args ) => {
183+ onSortStart = ( event ) => {
184184 const { onSortStart} = this . props ;
185185 this . setState ( { isSorting : true } ) ;
186186
187187 document . body . style . cursor = 'grabbing' ;
188188
189189 if ( onSortStart ) {
190- onSortStart ( this . refs . component , ... args ) ;
190+ onSortStart ( event , this . refs . component ) ;
191191 }
192192 } ;
193193
194- onSortEnd = ( { oldIndex , newIndex } ) => {
194+ onSortEnd = ( event ) => {
195195 const { onSortEnd} = this . props ;
196+ const { oldIndex, newIndex} = event ;
196197 const { items} = this . state ;
197198
198199 this . setState ( {
@@ -203,7 +204,7 @@ class ListWrapper extends Component {
203204 document . body . style . cursor = '' ;
204205
205206 if ( onSortEnd ) {
206- onSortEnd ( this . refs . component ) ;
207+ onSortEnd ( event , this . refs . component ) ;
207208 }
208209 } ;
209210
@@ -556,7 +557,7 @@ storiesOf('General | Layout / Grid', module)
556557 style . gridItem ,
557558 style . gridItemVariableSized ,
558559 ) }
559- onSortStart = { ( _ , { node} , event ) => {
560+ onSortStart = { ( { node} , event ) => {
560561 const boundingClientRect = node . getBoundingClientRect ( ) ;
561562
562563 transformOrigin . x =
@@ -581,19 +582,21 @@ storiesOf('General | Layout / Grid', module)
581582 finalNodes . forEach ( ( { node} , i ) => {
582583 const oldNode = nodes [ i ] . node ;
583584 const scale = oldNode . offsetWidth / node . offsetWidth ;
584- const wrapperNode = node . childNodes [ 0 ] ;
585+ const wrapperNode = node . querySelector ( `. ${ style . wrapper } ` ) ;
585586
586587 wrapperNode . style . transform = `scale(${ scale } )` ;
587588 wrapperNode . style . transformOrigin =
588589 newIndex > i ? '0 0' : '100% 0' ;
589590 } ) ;
590591 } }
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+ } ) ;
597600 } }
598601 />
599602 </ div >
@@ -762,7 +765,7 @@ storiesOf('Advanced examples | Virtualization libraries / react-window', module)
762765 items = { getItems ( 500 , 59 ) }
763766 itemHeight = { 59 }
764767 helperClass = { style . stylizedHelper }
765- onSortEnd = { ( ref ) => {
768+ onSortEnd = { ( _ , ref ) => {
766769 // We need to inform React Window that the order of the items has changed
767770 const instance = ref . getWrappedInstance ( ) ;
768771 const list = instance . refs . VirtualList ;
@@ -780,7 +783,7 @@ storiesOf('Advanced examples | Virtualization libraries / react-window', module)
780783 component = { SortableReactWindow ( VariableSizeList ) }
781784 items = { getItems ( 500 ) }
782785 helperClass = { style . stylizedHelper }
783- onSortEnd = { ( ref ) => {
786+ onSortEnd = { ( _ , ref ) => {
784787 // We need to inform React Window that the item heights have changed
785788 const instance = ref . getWrappedInstance ( ) ;
786789 const list = instance . refs . VirtualList ;
@@ -816,7 +819,7 @@ storiesOf(
816819 items = { getItems ( 500 ) }
817820 itemHeight = { 89 }
818821 helperClass = { style . stylizedHelper }
819- onSortEnd = { ( ref ) => {
822+ onSortEnd = { ( _ , ref ) => {
820823 // We need to inform React Virtualized that the item heights have changed
821824 const instance = ref . getWrappedInstance ( ) ;
822825 const list = instance . refs . VirtualList ;
0 commit comments