GA-MO / react-confirm-alert

react component confirm dialog.
https://ga-mo.github.io/react-confirm-alert/demo/
MIT License
272 stars 105 forks source link

"closeOnClickOutside" does not work with customUI #30

Closed AbhaysinghBhosale closed 5 years ago

AbhaysinghBhosale commented 5 years ago

I have used confirm alert in my application and want to disable outside click. ie user should not be able to click on outside of the confirm pop-up and should not close. Users have to explicitly use the button in alert to close pop-up.

But this is not working and users are still able to click outside to close pop-up.

       confirmAlert({
            customUI: ({ onClose }) => {
                return (
                    <div className='custom-confirm-ui'>
                        <div className='text-left'>
                            <p>test</p>
                        </div>
                        <button className="btn btn-cn btn-secondary" autoFocus="true" onClick={() => {
                            this.forceUpdate();
                            onClose();
                        }}> Ok </button>
                    </div>
                )
            },
            closeOnClickOutside: false
        })
GA-MO commented 5 years ago

@AbhaysinghBhosale Your code is working! Try this demo Try update package to the latest version

AbhaysinghBhosale commented 5 years ago

@GA-MO thanks for information, i did updated packages to latest version and its worked fine. Thanks