Skip to content

connect.dragLayer is not a function #9

@jamesdbrock

Description

@jamesdbrock

I'm trying to use DragDrop.dragLayer :: DragLayerProps item -> JSX so that I can render a drag ghost with opacity:0.2. Every way I try it, I get the exception:

TypeError: connect.dragLayer is not a function

thrown from here:

https://github.com/lumihq/purescript-react-dnd-basic/blob/e3a5a49654e843dea6ab363511ca7ae8ac3dfa49/src/React/Basic/ReactDND.js#L161

And in fact there is no dragLayer function in connect:

* connect: DragDropMonitor
  * store: {dispatch: ƒ, subscribe: ƒ, getState: ƒ, replaceReducer: ƒ, Symbol(observable): ƒ}
  * registry: HandlerRegistry {store: {…}, types: {…}, handlers: {…}, pinnedSourceId: null, pinnedSource: null}
  * __proto__:
    * constructor: ƒ DragDropMonitor(store)
    * subscribeToStateChange: ƒ subscribeToStateChange(listener)
    * subscribeToOffsetChange: ƒ subscribeToOffsetChange(listener)
    * canDragSource: ƒ canDragSource(sourceId)
    * canDropOnTarget: ƒ canDropOnTarget(targetId)
    * isDragging: ƒ isDragging()
    * isDraggingSource: ƒ isDraggingSource(sourceId)
    * isOverTarget: ƒ isOverTarget(targetId)
    * getItemType: ƒ getItemType()
    * getItem: ƒ getItem()
    * getSourceId: ƒ getSourceId()
    * getTargetIds: ƒ getTargetIds()
    * getDropResult: ƒ getDropResult()
    * didDrop: ƒ didDrop()
    * isSourcePublic: ƒ isSourcePublic()
    * getInitialClientOffset: ƒ getInitialClientOffset()
    * getInitialSourceClientOffset: ƒ getInitialSourceClientOffset()
    * getClientOffset: ƒ getClientOffset()
    * getSourceClientOffset: ƒ getSourceClientOffset()
    * getDifferenceFromInitialOffset: ƒ getDifferenceFromInitialOffset()
    * __proto__: Object

I'm depending on purescript-react-dnd-basic v6.1.4 with react-dnd v2.6.0.

It's not obvious to me how to use DragDrop.dragLayer. Should it be a parent or child of DragDrop.dragSource? Is this feature known to work in purescript-react-dnd-basic? Is there an example somewhere of how to use it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions