Skip to content
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

Can't pass type prop for Draggable to enable conditionally dropping #859

Open
holem opened this issue Nov 17, 2024 · 0 comments
Open

Can't pass type prop for Draggable to enable conditionally dropping #859

holem opened this issue Nov 17, 2024 · 0 comments

Comments

@holem
Copy link

holem commented Nov 17, 2024

Expected behavior

To enable conditionally dropping we need to specify type for each Draggable and Droppable. So Draggable with specific type can be dropped on Droppables with same value in type and can not be dropped on Droppables with any other value of type.

If so, we should be able to specify type for both Draggable and Droppable.

Actual behavior

We can specify type only for Droppable - https://github.com/hello-pangea/dnd/blob/main/src/view/droppable/droppable-types.ts:

export interface DefaultProps {
  direction: Direction;
  getContainerForClone: () => HTMLElement;
  ignoreContainerClipping: boolean;
  isCombineEnabled: boolean;
  isDropDisabled: boolean;
  mode: DroppableMode;
  type: TypeId;
  renderClone: DraggableChildrenFn | null;
}

But for Draggable we can not - https://github.com/hello-pangea/dnd/blob/main/src/view/draggable/draggable-types.ts:

export interface DraggableProps {
  draggableId: DraggableId;
  index: number;
  children: DraggableChildrenFn;
  // optional own props
  isDragDisabled?: boolean;
  disableInteractiveElementBlocking?: boolean;
  shouldRespectForcePress?: boolean;
}

Suggested solution?

Add type prop to Draggable.

What version of React are you using?

"react": "^18"

What version of @hello-pangea/dnd are you running?

"@hello-pangea/dnd": "17.0.0"

What browser are you using?

Chrome 130.0.6723.92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant