How to avoid native onDrop event from being overwritten for react-dnd?

泄露秘密 提交于 2019-12-06 07:30:16

问题


I'm successfully using react-dnd in a react component for a requirement of the application I'm working on.

Said component also has a button that show a simple modal window:

<Modal show={this.props.show} onHide={this.props.onHide} id={'image-modal'} {...this.props}  animation={true}>
      ...
      <Modal.Body>
          <div id="drop-target" onDragOver={this.handleDrag} onDrop={this.handleDrop}>
            <div className="text-center"><p>Put your image here</p></div>
          </div>
      </Modal.Body>
      ...
    </Modal> 

As you can see, this modal contains a div element that is listening for native html drag and drop events. My problem is that apparently these native events are somehow being overwritten for react-dnd, rendering them useless.

I tested by eliminating all reeact-dnd drop target from the component and as I expected, the native events are now working. How can I achieve the behavior I'm expecting?

来源:https://stackoverflow.com/questions/33747346/how-to-avoid-native-ondrop-event-from-being-overwritten-for-react-dnd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!