import React, { Component } from 'react';
import { DragLayer } from 'react-dnd';

const collectDragLayer = monitor => ({
  item: monitor.getItem(),
  itemType: monitor.getItemType(),
  clientOffset: monitor.getClientOffset(),
  initialClientOffset: monitor.getInitialClientOffset()
});

const getItemPosition = (
  {
    clientOffset,
    item,
    gridRect
  }
) => {
  if (!clientOffset) {
    return {
      display: 'none'
    };
  }
  let x;
  let y;
  if (item.position === 'right') {
    y = 0;
    x = Math.min(Math.max(clientOffset.x - gridRect.left, 0), gridRect.width);
  } else {
    x = 0;
    y = Math.min(Math.max(clientOffset.y - gridRect.top, 0), gridRect.height);
  }

  const transform = `translate(${x}px, ${y}px)`;
  return {
    transform,
    WebkitTransform: transform
  };
};

class CustomDragLayer extends Component {
  render() {
    let height;
    let width;
    if (
      !this.props.item ||
      this.props.itemType.substring(0, 18) !== 'cell-resize-handle' ||
      this.props.item.gridId !== this.props.gridId
    ) {
      return null;
    }
    const { position, previewSize } = this.props.item;
    if (position === 'right') {
      width = 2;
      height = previewSize;
    } else {
      width = previewSize;
      height = 2;
    }
    return (
      <div
        style={{
          position: 'absolute',
          pointerEvents: 'none',
          zIndex: 100,
          left: 0,
          top: 0,
          width: '100%',
          height: '100%'
        }}
      >
        <div
          style={{
            position: 'absolute',
            height,
            width,
            backgroundColor: 'grey',
            ...getItemPosition(this.props)
          }}
        />
      </div>
    );
  }
}

export default DragLayer(collectDragLayer)(CustomDragLayer);

@@ -494,24 +494,27 @@
   y = 0;%0A   
+ //
  x = Math.mi
@@ -577,16 +577,56 @@
 width);%0A
+    x = clientOffset.x - gridRect.left;%0A
   %7D else
@@ -638,24 +638,27 @@
   x = 0;%0A   
+ //
  y = Math.mi
@@ -721,16 +721,55 @@
 eight);%0A
+    y = clientOffset.y - gridRect.top;%0A
   %7D%0A%0A  c

Remove buggy checks on grid width and height