Skip to content

Commit cbad92c

Browse files
committed
Fix type error
1 parent d6b5736 commit cbad92c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/react/src/core/draggable/DragOverlay.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface Props<T extends Data, U extends Draggable<T>> {
1111
children: ReactNode | ((source: U) => ReactNode);
1212
style?: React.CSSProperties;
1313
tag?: string;
14-
disabled?: boolean | ((source: U) => boolean);
14+
disabled?: boolean | ((source: U | null) => boolean);
1515
}
1616

1717
export function DragOverlay<T extends Data, U extends Draggable<T>>({
@@ -23,10 +23,8 @@ export function DragOverlay<T extends Data, U extends Draggable<T>>({
2323
}: Props<T, U>) {
2424
const ref = useRef<HTMLDivElement | null>(null);
2525
const manager = useDragDropManager();
26-
const source = useComputed(
27-
() => manager?.dragOperation.source,
28-
[manager]
29-
).value;
26+
const source: U | null =
27+
useComputed(() => manager?.dragOperation.source, [manager]).value ?? null;
3028
const isDisabled =
3129
typeof disabled === 'function' ? disabled(source) : disabled;
3230

0 commit comments

Comments
 (0)