Closed DanielMargolin-Taboola closed 5 years ago
@DanielMargolin-Taboola
Thanks a lot for the issue.
I think we should call confirmAlert()
again, But we have to check if there is an old element just rerender.
function createElementReconfirm (properties) {
// If has this DOM just rerender
let divTarget = document.getElementById('react-confirm-alert')
if (divTarget) {
// Rerender
render(<ReactConfirmAlert {...properties} />, divTarget)
return
}
document.body.children[0].classList.add('react-confirm-alert-blur')
divTarget = document.createElement('div')
divTarget.id = 'react-confirm-alert'
document.body.appendChild(divTarget)
render(<ReactConfirmAlert {...properties} />, divTarget)
}
// and
function createSVGBlurReconfirm () {
// If has svg ignore to create the svg
const svg = document.getElementById('react-confirm-alert-firm-svg')
if (svg) return
...
...
}
Hi @GA-MO,
I agree with you 👍
I made the changes as you suggested (in createElementReconfirm
I preferred using if
else
statements cause I thought it will be a little bit more readable).
Exporting new function which rerenders the ReactConfirmAlert component with the given properties