MCPcopy Create free account
hub / github.com/ElemeFE/element-react / willUnmount

Function willUnmount

src/notification/NotificationCenter.jsx:34–47  ·  view source on GitHub ↗
(height, top)

Source from the content-addressed store, hash-verified

32
33 const element = React.createElement(Notification, Object.assign({}, props, {
34 willUnmount(height, top) {
35 setTimeout(() => document.body.removeChild(div));
36 requestAnimationFrame(() => {
37 const instances = document.querySelectorAll(className);
38 const len = instances.length;
39 for (let i = 0; i < len; i++) {
40 const element = instances[i];
41 const elementTop = parseInt(element.style.top);
42 if (elementTop > top) {
43 element.style.top = `${elementTop - height - 16}px`;
44 }
45 }
46 })
47 }
48 }));
49
50 ReactDOM.render(element, div);

Callers 2

renderMethod · 0.85
renderMethod · 0.85

Calls 1

removeChildMethod · 0.80

Tested by

no test coverage detected