Skip to content

Commit ce08af4

Browse files
committed
handle currentItem?.nextKey != null
1 parent 1c2ffec commit ce08af4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/@react-aria/dnd/src/TreeDropTargetDelegate.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ interface PointerTracking {
3737
}
3838

3939
const X_SWITCH_THRESHOLD = 3;
40-
const Y_SWITCH_THRESHOLD = 4;
40+
const Y_SWITCH_THRESHOLD = 2;
4141

4242
export class TreeDropTargetDelegate<T> extends ListDropTargetDelegate {
4343
private state: TreeState<T>;
@@ -66,6 +66,7 @@ export class TreeDropTargetDelegate<T> extends ListDropTargetDelegate {
6666
}
6767

6868
let target = this.resolveDropTarget(baseTarget, x, y, isValidDropTarget);
69+
console.log(target);
6970

7071
return target;
7172
}
@@ -162,6 +163,10 @@ export class TreeDropTargetDelegate<T> extends ListDropTargetDelegate {
162163
}
163164
}
164165

166+
if (currentItem?.nextKey != null) {
167+
return [originalTarget];
168+
}
169+
165170
// Walk up the parent chain to find ancestors that are the last child at their level
166171
let parentKey = currentItem?.parentKey;
167172
let ancestorTargets: ItemDropTarget[] = [];
@@ -236,7 +241,7 @@ export class TreeDropTargetDelegate<T> extends ListDropTargetDelegate {
236241
if (potentialTargets.length === 2) {
237242
// Initialize boundary context if needed
238243
if (!tracking.boundaryContext || tracking.boundaryContext.parentKey !== parentKey) {
239-
let initialTargetIndex = tracking.yDirection === 'up' ? 1 : 0;
244+
let initialTargetIndex = currentYMovement === 'up' ? 1 : 0;
240245

241246
tracking.boundaryContext = {
242247
parentKey,

0 commit comments

Comments
 (0)