react-native-drag-sort
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -104,15 +104,17 @@ import React, {Component} from 'react' | ||
//出界后取最大或最小值 | ||
if (this.touchCurItem.originLeft + dx < 0) { | ||
dx = -this.touchCurItem.originLeft | ||
} else if (this.touchCurItem.originLeft + dx > maxWidth) { | ||
dx = maxWidth - this.touchCurItem.originLeft | ||
// Is it free to drag | ||
if (!this.props.isDragFreely) { | ||
// Maximum or minimum after out of bounds | ||
if (this.touchCurItem.originLeft + dx < 0) { | ||
dx = -this.touchCurItem.originLeft | ||
} else if (this.touchCurItem.originLeft + dx > maxWidth) { | ||
dx = maxWidth - this.touchCurItem.originLeft | ||
} | ||
if (this.touchCurItem.originTop + dy < 0) { | ||
dy = -this.touchCurItem.originTop | ||
} else if (this.touchCurItem.originTop + dy > maxHeight) { | ||
dy = maxHeight - this.touchCurItem.originTop | ||
} | ||
} | ||
if (this.touchCurItem.originTop + dy < 0) { | ||
dy = -this.touchCurItem.originTop | ||
} else if (this.touchCurItem.originTop + dy > maxHeight) { | ||
dy = maxHeight - this.touchCurItem.originTop | ||
} | ||
let left = this.touchCurItem.originLeft + dx | ||
@@ -132,2 +134,5 @@ let top = this.touchCurItem.originTop + dy | ||
if (this.props.onDragging) { | ||
this.props.onDragging(gestureState,left,top) | ||
} | ||
@@ -150,3 +155,7 @@ let moveToIndex = 0 | ||
if (moveToIndex > this.state.dataSource.length-1) moveToIndex = this.state.dataSource.length-1 | ||
if (moveToIndex > this.state.dataSource.length-1) { | ||
moveToIndex = this.state.dataSource.length-1 | ||
} else if (moveToIndex < 0) { | ||
moveToIndex = 0; | ||
} | ||
@@ -416,2 +425,4 @@ if (this.touchCurItem.moveToIndex != moveToIndex ) { | ||
delayLongPress: PropTypes.number, | ||
isDragFreely: PropTypes.bool, | ||
onDragging: PropTypes.func | ||
} | ||
@@ -427,3 +438,4 @@ | ||
scaleStatus: 'scale', | ||
fixedItems: [] | ||
fixedItems: [], | ||
isDragFreely: false, | ||
} | ||
@@ -430,0 +442,0 @@ |
@@ -23,6 +23,8 @@ import React, { Component } from 'react' | ||
fixedItems?: number[]; | ||
keyExtractor?: (item: any,index: number) => any, | ||
delayLongPress?: number | ||
keyExtractor?: (item: any,index: number) => any; | ||
delayLongPress?: number; | ||
isDragFreely?: boolean; | ||
onDragging?: (gestureState: any,left: number,top: number) => void; | ||
} | ||
export default class DragSortableView extends Component<IProps>{} |
{ | ||
"name": "react-native-drag-sort", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "Drag and drop sort control for react-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,2 +15,11 @@ # react-native-drag-sort | ||
#### 2019.10 | ||
> Add a new scene based on user needs. | ||
- Add attribute (isDragFreely): Whether to limit the drag space. | ||
- Add property callback function (onDragging) | ||
- Add demo Demo: DragDeletePage | ||
![dragdelete.gif](https://upload-images.jianshu.io/upload_images/2646598-4d22ddb8f92a6563.gif?imageMogr2/auto-orient/strip) | ||
#### 2019.7 | ||
@@ -97,2 +106,4 @@ > The 1.x version ends, the optimizations are optimized, and the problems that have occurred have been resolved. The 2.x version will be written next, and it is expected to add an auto-compatible ScrollView slide, slide delete function, and so on. | ||
- **keyExtractor**: keyExtractor: PropTypes.func //(item,index) => key | ||
- **delayLongPress**: PropTypes.number | ||
- **delayLongPress**: PropTypes.number | ||
- **isDragFreely**: PropTypes.bool, // Whether to limit the drag space | ||
- **onDragging**: PropTypes.func |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50683
406
107