Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.
Open
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
9 changes: 8 additions & 1 deletion docs/api/droppable.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type Props = {|
ignoreContainerClipping?: boolean,
renderClone?: DraggableChildrenFn,
getContainerForClone?: () => HTMLElement,
children: (DroppableProvided, DroppableStateSnapshot) => Node,
children: DroppableChildrenFn,
|};

type DroppableMode = 'standard' | 'virtual';
Expand Down Expand Up @@ -72,6 +72,13 @@ The `React` children of a `<Droppable />` must be a function that returns a [`Re
</Droppable>
```

```js
type DroppableChildrenFn = (
DroppableProvided,
DroppableStateSnapshot,
) => Node;
```

The function is provided with two arguments:

### 1. provided: (DroppableProvided)
Expand Down
5 changes: 4 additions & 1 deletion docs/guides/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ type DroppableStateSnapshot = {|
draggingFromThisWith: ?DraggableId,
isUsingPlaceholder: boolean,
|};
type DroppableChildrenFn = (
DroppableProvided,
DroppableStateSnapshot,
) => Node;
```

### Draggable
Expand Down Expand Up @@ -164,7 +168,6 @@ type DraggableChildrenFn = (
DraggableStateSnapshot,
DraggableRubric,
) => Node | null;
|};
type DraggableStyle = DraggingStyle | NotDraggingStyle;
type DraggingStyle = {|
position: 'fixed',
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export type {
Provided as DroppableProvided,
StateSnapshot as DroppableStateSnapshot,
DroppableProps,
DroppableChildrenFn,
} from './view/droppable/droppable-types';

// Draggable types
Expand All @@ -63,5 +64,5 @@ export type {
DraggableStyle,
DraggingStyle,
NotDraggingStyle,
ChildrenFn as DraggableChildrenFn,
DraggableChildrenFn,
} from './view/draggable/draggable-types';
4 changes: 2 additions & 2 deletions src/view/draggable/draggable-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export type MapProps = {|
// secondary: ?SecondaryMapProps,
|};

export type ChildrenFn = (
export type DraggableChildrenFn = (
Provided,
StateSnapshot,
DraggableRubric,
Expand All @@ -161,7 +161,7 @@ export type ChildrenFn = (
export type PublicOwnProps = {|
draggableId: DraggableId,
index: number,
children: ChildrenFn,
children: DraggableChildrenFn,

// optional own props
isDragDisabled?: boolean,
Expand Down
11 changes: 8 additions & 3 deletions src/view/droppable/droppable-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import type {
DraggableRubric,
DroppableMode,
} from '../../types';
import type { ChildrenFn } from '../draggable/draggable-types';
import type { DraggableChildrenFn } from '../draggable/draggable-types';
import { updateViewportMaxScroll } from '../../state/action-creators';

export type DraggableChildrenFn = ChildrenFn;
export type DraggableChildrenFn;

export type DroppableProps = {|
// used for shared global styles
Expand Down Expand Up @@ -73,9 +73,14 @@ export type DispatchProps = {|
updateViewportMaxScroll: typeof updateViewportMaxScroll,
|};

export type DroppableChildrenFn = (
Provided,
StateSnapshot,
) => Node;

export type OwnProps = {|
...DefaultProps,
children: (Provided, StateSnapshot) => Node,
children: DroppableChildrenFn,
droppableId: DroppableId,
renderClone: ?DraggableChildrenFn,
|};
Expand Down