minutemailer / react-popup

React popup component
http://minutemailer.github.io/react-popup/
MIT License
208 stars 71 forks source link

Properties lost when creating plugins #50

Closed brianantonelli closed 6 years ago

brianantonelli commented 6 years ago

If I create a plugin following the example docs everything works great, except some of the properties are being reverted to their defaults in the state. If I try to override closeBtn, closeHtml, escToClose the properties are stored in the initial components state, but when setState() is called on the component its not passing these parameters so their values are dropped. This does work for closeOnOutsideClick as its included in the setState() call..

Example:

this.create({
    title: 'Login',
    content: content,
    closeBtn: false,
    closeHtml: null,
    escToClose: false,
    closeOnOutsideClick: false,
    buttons: {
        left: [ 'Cancel' ],
        right: [{
            text: 'Login',
            className: 'success',
            action: () => {
                callback();
                Popup.close();
            }
        }]
    }
});

The issue is that this setState() call isn't supplying all of the supported properties: https://github.com/minutemailer/react-popup/blob/master/src/Popup.react.js#L212-L222

tbleckert commented 6 years ago
closeBtn: false,
closeHtml: null,
escToClose: false

Those are not supported on popups, only as global properties when mounting the component.