Created
March 31, 2016 06:18
-
-
Save burgalon/870a68de68c5ed15c416fab63589d503 to your computer and use it in GitHub Desktop.
Draggable React Bootstrap modal
This file contains 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> |
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
If you have trouble with the newer version of react-bootstrap. Try my updated gist here https://gist.github.com/hungqcao/571fa6dfe0522847b182a228e4d852af