-
-
Save cooljith91112/ff01ca784cee9cc7fda7a3f3ac3bf886 to your computer and use it in GitHub Desktop.
Draggable React Bootstrap modal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.