mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-01-12 22:51:09 +08:00
[fix] Memory leak in applyLayout registry
Remove component instances from the layout registry when umounting views that are using ResizeObserver. Fix #1133 Close #1134
This commit is contained in:
committed by
Nicolas Gallagher
parent
bfaeae904e
commit
ad188a7ad6
@@ -63,14 +63,15 @@ const observe = instance => {
|
||||
};
|
||||
|
||||
const unobserve = instance => {
|
||||
delete registry[instance._layoutId];
|
||||
if (resizeObserver) {
|
||||
const node = findNodeHandle(instance);
|
||||
if (node) {
|
||||
delete registry[node._layoutId];
|
||||
delete node._layoutId;
|
||||
resizeObserver.unobserve(node);
|
||||
}
|
||||
} else {
|
||||
delete registry[instance._layoutId];
|
||||
delete instance._layoutId;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user