mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix: ensure reusable ProxyViewContainer re-adds native children (#9882)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user