Skip to content

Instantly share code, notes, and snippets.

@burgalon
Created March 31, 2016 06:18
Show Gist options
  • Save burgalon/870a68de68c5ed15c416fab63589d503 to your computer and use it in GitHub Desktop.
Save burgalon/870a68de68c5ed15c416fab63589d503 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>
@willbee28
Copy link

Use 'dialogAs' as opposed o 'dialogComponent' as of the v1.0.0 beta

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