@@ -115,7 +115,8 @@ export default class DragSortableView extends Component{
115
115
116
116
if ( ! this . props . sortable ) return
117
117
118
- if ( this . sortRefs . has ( touchIndex ) ) {
118
+ const key = this . _getKey ( touchIndex ) ;
119
+ if ( this . sortRefs . has ( key ) ) {
119
120
if ( this . props . onDragStart ) {
120
121
this . props . onDragStart ( touchIndex )
121
122
}
@@ -128,7 +129,7 @@ export default class DragSortableView extends Component{
128
129
}
129
130
) . start ( ( ) => {
130
131
this . touchCurItem = {
131
- ref : this . sortRefs . get ( touchIndex ) ,
132
+ ref : this . sortRefs . get ( key ) ,
132
133
index : touchIndex ,
133
134
originLeft : this . state . dataSource [ touchIndex ] . originLeft ,
134
135
originTop : this . state . dataSource [ touchIndex ] . originTop ,
@@ -416,15 +417,20 @@ export default class DragSortableView extends Component{
416
417
)
417
418
}
418
419
420
+ _getKey = ( index ) => {
421
+ const item = this . state . dataSource [ index ] ;
422
+ return this . props . keyExtractor ? this . props . keyExtractor ( item . data , index ) : item . originIndex ;
423
+ }
424
+
419
425
_renderItemView = ( ) => {
420
426
return this . state . dataSource . map ( ( item , index ) => {
421
427
const transformObj = { }
422
428
transformObj [ this . props . scaleStatus ] = item . scaleValue
423
- const key = this . props . keyExtractor ? this . props . keyExtractor ( item . data , index ) : item . originIndex
429
+ const key = this . _getKey ( index ) ;
424
430
return (
425
431
< Animated . View
426
432
key = { key }
427
- ref = { ( ref ) => this . sortRefs . set ( index , ref ) }
433
+ ref = { ( ref ) => this . sortRefs . set ( key , ref ) }
428
434
{ ...this . _panResponder . panHandlers }
429
435
style = { [ styles . item , {
430
436
marginTop : this . props . marginChildrenTop ,
0 commit comments