Skip to content

fix:DragSortableView和AutoDragSortableView组件拖拽排序会出现空白问题 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions lib/AutoDragSortableView.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export default class AutoDragSortableView extends Component{
const left = this.touchCurItem.originLeft + dx;
const top = this.touchCurItem.originTop + dy;

this.touchCurItem.ref.setNativeProps({
this.touchCurItem.ref?.setNativeProps({
style: {
zIndex: touchZIndex,
}
Expand Down Expand Up @@ -368,13 +368,7 @@ export default class AutoDragSortableView extends Component{
} else if (index >= moveToIndex && index < this.touchCurItem.index) {
nextItem = this.state.dataSource[index+1]

} else if (index != this.touchCurItem.index &&
(item.position.x._value != item.originLeft ||
item.position.y._value != item.originTop)) {
nextItem = this.state.dataSource[index]

} else if ((this.touchCurItem.index-moveToIndex > 0 && moveToIndex == index+1) ||
(this.touchCurItem.index-moveToIndex < 0 && moveToIndex == index-1)) {
} else {
nextItem = this.state.dataSource[index]
}

Expand Down Expand Up @@ -415,7 +409,7 @@ export default class AutoDragSortableView extends Component{
}
).start(()=>{
if (this.touchCurItem) {
this.touchCurItem.ref.setNativeProps({
this.touchCurItem.ref?.setNativeProps({
style: {
zIndex: defaultZIndex,
}
Expand Down
12 changes: 3 additions & 9 deletions lib/DragSortableView.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default class DragSortableView extends Component{
let left = this.touchCurItem.originLeft + dx
let top = this.touchCurItem.originTop + dy

this.touchCurItem.ref.setNativeProps({
this.touchCurItem.ref?.setNativeProps({
style: {
zIndex: touchZIndex,
}
Expand Down Expand Up @@ -227,13 +227,7 @@ export default class DragSortableView extends Component{
} else if (index >= moveToIndex && index < this.touchCurItem.index) {
nextItem = this.state.dataSource[index+1]

} else if (index != this.touchCurItem.index &&
(item.position.x._value != item.originLeft ||
item.position.y._value != item.originTop)) {
nextItem = this.state.dataSource[index]

} else if ((this.touchCurItem.index-moveToIndex > 0 && moveToIndex == index+1) ||
(this.touchCurItem.index-moveToIndex < 0 && moveToIndex == index-1)) {
} else {
nextItem = this.state.dataSource[index]
}

Expand Down Expand Up @@ -271,7 +265,7 @@ export default class DragSortableView extends Component{
useNativeDriver: false,
}
).start(()=>{
this.touchCurItem.ref.setNativeProps({
this.touchCurItem.ref?.setNativeProps({
style: {
zIndex: defaultZIndex,
}
Expand Down
Empty file added lib/harmony/.gitkeep
Empty file.
13 changes: 9 additions & 4 deletions lib/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "react-native-drag-sort",
"name": "@react-native-oh-tpl/react-native-drag-sort",
"version": "2.4.4",
"description": "Drag and drop sort control for react-native",
"main": "index.js",
"main": "index",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand All @@ -23,10 +23,15 @@
],
"author": "mochixuan",
"license": "ISC",
"dependencies": {},
"dependencies": {
"react-native-drag-sort": "^2.4.4"
},
"devDependencies": {},
"bugs": {
"url": "https://github.com/mochixuan/react-native-drag-sort/issues"
},
"homepage": "https://github.com/mochixuan/react-native-drag-sort#readme"
"homepage": "https://github.com/mochixuan/react-native-drag-sort#readme",
"harmony": {
"alias": "react-native-drag-sort"
}
}