You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-06-24 16:41:47 +03:00
Add method to Modal to create dialog with instantiated React elements as well as Classes.
This commit is contained in:
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;
|
||||
|
||||
|
Reference in New Issue
Block a user