Skip to content

Instantly share code, notes, and snippets.

@cooljith91112
Forked from burgalon/DraggableModal.js
Created June 28, 2019 11:37
Show Gist options
  • Save cooljith91112/ff01ca784cee9cc7fda7a3f3ac3bf886 to your computer and use it in GitHub Desktop.
Save cooljith91112/ff01ca784cee9cc7fda7a3f3ac3bf886 to your computer and use it in GitHub Desktop.
Draggable React Bootstrap modal
import { Modal } from 'react-bootstrap'
import ModalDialog from 'react-bootstrap/lib/ModalDialog'
class DraggableModalDialog extends React.Component {
render() {
return <Draggable handle=".modal-title"><ModalDialog {...this.props} /></Draggable>
}
}
// enforceForce=false causes recursion exception otherwise....
export default ({titleIconClass, modalClass, children, title, ...props}) =>
<Modal dialogComponent={DraggableModalDialog} show={true} enforceFocus={false} backdrop="static" {...props}>
<Modal.Header closeButton>
<Modal.Title>
{title}
</Modal.Title>
</Modal.Header>
<Modal.Body>
{children}
</Modal.Body>
</Modal>
@cooljith91112
Copy link
Author

cooljith91112 commented Jun 28, 2019

import Draggable from 'react-draggable';`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment