@@ -4,10 +4,11 @@ import classNames from 'classnames';
4
4
import domUtils from './utils/domUtils' ;
5
5
import EventListener from './utils/EventListener' ;
6
6
import createChainedFunction from './utils/createChainedFunction' ;
7
+ import CustomPropTypes from './utils/CustomPropTypes' ;
7
8
8
9
import Portal from './Portal' ;
9
10
import Fade from './Fade' ;
10
- import Dialog from './ModalDialog' ;
11
+ import ModalDialog from './ModalDialog' ;
11
12
import Body from './ModalBody' ;
12
13
import Header from './ModalHeader' ;
13
14
import Title from './ModalTitle' ;
@@ -94,7 +95,7 @@ function getScrollbarSize(){
94
95
const Modal = React . createClass ( {
95
96
propTypes : {
96
97
...Portal . propTypes ,
97
- ...Dialog . propTypes ,
98
+ ...ModalDialog . propTypes ,
98
99
99
100
/**
100
101
* Include a backdrop component. Specify 'static' for a backdrop that doesn't trigger an "onHide" when clicked.
@@ -110,6 +111,12 @@ const Modal = React.createClass({
110
111
*/
111
112
animation : React . PropTypes . bool ,
112
113
114
+ /**
115
+ * A Component type that provides the modal content Markup. This is a useful prop when you want to use your own
116
+ * styles and markup to create a custom modal component.
117
+ */
118
+ dialogComponent : CustomPropTypes . elementType ,
119
+
113
120
/**
114
121
* When `true` The modal will automatically shift focus to itself when it opens, and replace it to the last focused element when it closes.
115
122
* Generally this should never be set to false as it makes the Modal less accessible to assistive technologies, like screen-readers.
@@ -127,6 +134,7 @@ const Modal = React.createClass({
127
134
getDefaultProps ( ) {
128
135
return {
129
136
bsClass : 'modal' ,
137
+ dialogComponent : ModalDialog ,
130
138
show : false ,
131
139
animation : true ,
132
140
backdrop : true ,
@@ -145,6 +153,7 @@ const Modal = React.createClass({
145
153
let { onExit, onExiting, onEnter, onEntering, onEntered } = props ;
146
154
147
155
let show = ! ! props . show ;
156
+ let Dialog = props . dialogComponent ;
148
157
149
158
const mountModal = show || ( animation && ! this . state . exited ) ;
150
159
if ( ! mountModal ) {
@@ -434,7 +443,7 @@ Modal.Header = Header;
434
443
Modal . Title = Title ;
435
444
Modal . Footer = Footer ;
436
445
437
- Modal . Dialog = Dialog ;
446
+ Modal . Dialog = ModalDialog ;
438
447
439
448
Modal . TRANSITION_DURATION = 300 ;
440
449
Modal . BACKDROP_TRANSITION_DURATION = 150 ;
0 commit comments