From 6e3dd4da516988965fd77eb3477cd5556c97db20 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Sat, 30 Apr 2022 14:56:25 -0300 Subject: [PATCH] fix: ensure reusable ProxyViewContainer re-adds native children (#9882) --- .../core/ui/proxy-view-container/index.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/packages/core/ui/proxy-view-container/index.ts b/packages/core/ui/proxy-view-container/index.ts index aec10d7ce..6a5cd6960 100644 --- a/packages/core/ui/proxy-view-container/index.ts +++ b/packages/core/ui/proxy-view-container/index.ts @@ -66,6 +66,35 @@ export class ProxyViewContainer extends LayoutBase { }); } + _setupUI(context: any, atIndex?: number, parentIsLoaded?: boolean) { + let processChildren = false; + if (this.reusable && this._context === context) { + processChildren = true; + } + super._setupUI(context, atIndex, parentIsLoaded); + if (this.reusable && processChildren) { + this.eachChild((child) => { + const oldReusable = child.reusable; + child.reusable = true; + child._setupUI(context); + child.reusable = oldReusable; + return true; + }); + } + } + _tearDownUI(force?: boolean) { + super._tearDownUI(force); + if (this.reusable && !force) { + this.eachChild((child) => { + const oldReusable = child.reusable; + child.reusable = true; + child._tearDownUI(); + child.reusable = oldReusable; + return true; + }); + } + } + public _addViewToNativeVisualTree(child: View, atIndex?: number): boolean { if (Trace.isEnabled()) { Trace.write('ProxyViewContainer._addViewToNativeVisualTree for a child ' + child + ' ViewContainer.parent: ' + this.parent, Trace.categories.ViewHierarchy);