Add method to Modal to create dialog with instantiated React elements as well as Classes.
This commit is contained in:
parent
05f7a3b4d1
commit
0791cac572
3 changed files with 28 additions and 9 deletions
23
src/Modal.js
23
src/Modal.js
|
@ -34,6 +34,29 @@ module.exports = {
|
|||
return container;
|
||||
},
|
||||
|
||||
createDialogWithElement: function(element, props) {
|
||||
var self = this;
|
||||
|
||||
var closeDialog = function() {
|
||||
React.unmountComponentAtNode(self.getOrCreateContainer());
|
||||
|
||||
if (props && props.onFinished) props.onFinished.apply(null, arguments);
|
||||
};
|
||||
|
||||
var dialog = (
|
||||
<div className="mx_Dialog_wrapper">
|
||||
<div className="mx_Dialog">
|
||||
{element}
|
||||
</div>
|
||||
<div className="mx_Dialog_background" onClick={closeDialog}></div>
|
||||
</div>
|
||||
);
|
||||
|
||||
React.render(dialog, this.getOrCreateContainer());
|
||||
|
||||
return {close: closeDialog};
|
||||
},
|
||||
|
||||
createDialog: function (Element, props) {
|
||||
var self = this;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue