diff --git a/lib/AutoDragSortableView.js b/lib/AutoDragSortableView.js index 6e146d3..ca0595d 100644 --- a/lib/AutoDragSortableView.js +++ b/lib/AutoDragSortableView.js @@ -644,19 +644,27 @@ export default class AutoDragSortableView extends Component{ opacity: item.scaleValue.interpolate({inputRange,outputRange}), transform: [transformObj] }]}> - this.onPressOut()} - onLongPress={()=>this.startTouch(index)} - onPress={()=>{ - if (this.props.onClickItem) { - this.isHasMeasure = true - this.props.onClickItem(this.getOriginalData(),item.data,index) - } - }}> - {this.props.renderItem(item.data,index)} - + {this.props.dontWrapItems ? + this.props.renderItem(item.data, index, { + delayLongPress: this.props.delayLongPress, + onPressOut: () => this.onPressOut(), + onLongPress: () => this.startTouch(index), + }) : + this.onPressOut()} + onLongPress={()=>this.startTouch(index)} + onPress={()=>{ + if (this.props.onClickItem) { + this.isHasMeasure = true + this.props.onClickItem(this.getOriginalData(),item.data,index) + } + }}> + {this.props.renderItem(item.data,index)} + + } + ) }) @@ -682,6 +690,8 @@ AutoDragSortableView.propTypes = { sortable: PropTypes.bool, + dontWrapItems: PropTypes.bool, + onClickItem: PropTypes.func, onDragStart: PropTypes.func, onDragEnd: PropTypes.func, diff --git a/lib/index.d.ts b/lib/index.d.ts index f270f76..7db1967 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -14,11 +14,13 @@ interface IProps{ sortable?: boolean; + dontWrapItems?: boolean; + onClickItem?: (data: any[],item: any,index: number) => void; onDragStart?: (fromIndex: number) => void; onDragEnd?: (fromIndex: number,toIndex: number) => void; onDataChange?: (data: any[]) => void; - renderItem: (item: any,index: number) => React.ReactElement; + renderItem: (item: any, index: number, touchableProps?: any) => React.ReactElement; scaleStatus?: 'scale' | 'scaleX' |'scaleY'; fixedItems?: number[]; keyExtractor?: (item: any,index: number) => any;