jasonleibowitz/react-add-to-calendar-hoc

TypeError with React Bootstrap Modal

ezgitetik opened this issue · 0 comments

I am trying to use with React bootstrap Modal component. I created ModalWrapper as:

import { Modal } from "react-bootstrap"
const ModalWrapper = ({ children, isOpen, onRequestClose }) => {
  return (
    <Modal
      show={isOpen}
      onHide={onRequestClose}
      centered
    >
      <Modal.Header closeButton>
        <Modal.Title>Add to calendar</Modal.Title>
      </Modal.Header>
      <Modal.Body>
        {children}
      </Modal.Body>
    </Modal>
  );
};

const AddToCalendarModal = AddToCalendarHOC(Button, ModalWrapper);
...
      <AddToCalendarModal
        className={componentStyles}
        linkProps={{
          className: linkStyles,
        }}
        event={event}
        items={[SHARE_SITES.GOOGLE, SHARE_SITES.ICAL]}
      />

When I try to close modal, I am getting typeError as:

TypeError: Cannot read property 'preventDefault' of undefined
onHide
node_modules/react-add-to-calendar-hoc/lib/index.js:93
  90 |     window.open(url, '_blank');
  91 |   }
  92 | }), _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleDropdownToggle", function (e) {
> 93 |   e.preventDefault();
     | ^  94 | 
  95 |   _this.setState(function (prevState) {
  96 |     return {
View compiled

onHide
node_modules/react-bootstrap/esm/Modal.js:60
  57 | };
  58 | _this.modalContext = {
  59 |   onHide: function onHide() {
> 60 |     return _this.props.onHide();
     | ^  61 |   }
  62 | };
  63 | 

Could you please help me about that?