Content-Length: 14030 | pFad | http://github.com/NativeScript/NativeScript/pull/10913.patch
thub.com
From 409bcf0f7158d88fe500675f2f12f68545ab194a Mon Sep 17 00:00:00 2001
From: "kinglokesh2203gmail.com"
Date: Sun, 2 Nov 2025 00:18:30 +0530
Subject: [PATCH 1/5] fix(core): make ProxyViewContainer.hidden hide child
views (#10912)
---
packages/core/ui/proxy-view-container/index.ts | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/packages/core/ui/proxy-view-container/index.ts b/packages/core/ui/proxy-view-container/index.ts
index aafcf82f97..a5b71396ba 100644
--- a/packages/core/ui/proxy-view-container/index.ts
+++ b/packages/core/ui/proxy-view-container/index.ts
@@ -231,6 +231,14 @@ export class ProxyViewContainer extends LayoutBase {
child[propName] = value;
child[proxyPropName] = value;
}
+ public set hidden(value: boolean) {
+ super.hidden = value;
+ this.eachChildView((child) => {
+ child.hidden = value;
+ return true;
+ });
+}
+
}
// Layout propeties to be proxyed to the child views
From 4c76164632e0f1d0ee49db37df5560f2b3f8090e Mon Sep 17 00:00:00 2001
From: "kinglokesh2203gmail.com"
Date: Tue, 4 Nov 2025 20:49:18 +0530
Subject: [PATCH 2/5] fix(core): make ProxyViewContainer.hidden hide child
views
---
.../core/ui/proxy-view-container/index.ts | 93 ++++---------------
1 file changed, 18 insertions(+), 75 deletions(-)
diff --git a/packages/core/ui/proxy-view-container/index.ts b/packages/core/ui/proxy-view-container/index.ts
index a5b71396ba..f555f1b5a7 100644
--- a/packages/core/ui/proxy-view-container/index.ts
+++ b/packages/core/ui/proxy-view-container/index.ts
@@ -11,9 +11,9 @@ import { Trace } from '../../trace';
*/
// Cases to cover:
// * Child is added to the attached proxy. Handled in _addViewToNativeVisualTree.
-// * Proxy (with children) is added to the DOM. In _addViewToNativeVisualTree _addViewToNativeVisualTree recursively when the proxy is added to the parent.
+// * Proxy (with children) is added to the DOM. In _addViewToNativeVisualTree recursively when the proxy is added to the parent.
// * Child is removed from attached proxy. Handled in _removeViewFromNativeVisualTree.
-// * Proxy (with children) is removed form the DOM. In _removeViewFromNativeVisualTree recursively when the proxy is removed from its parent.
+// * Proxy (with children) is removed from the DOM. In _removeViewFromNativeVisualTree recursively when the proxy is removed from its parent.
@CSSType('ProxyViewContainer')
export class ProxyViewContainer extends LayoutBase {
private proxiedLayoutProperties = new Set();
@@ -34,10 +34,6 @@ export class ProxyViewContainer extends LayoutBase {
return null;
}
- // get nativeView(): any {
- // return null;
- // }
-
get isLayoutRequested(): boolean {
// Always return false so all layout requests from children bubble up.
return false;
@@ -51,10 +47,8 @@ export class ProxyViewContainer extends LayoutBase {
let result = 0;
this.eachChildView((cv) => {
result += cv._getNativeViewsCount();
-
return true;
});
-
return result;
}
@@ -63,7 +57,6 @@ export class ProxyViewContainer extends LayoutBase {
if (!cv.isCollapsed) {
cv._eachLayoutView(callback);
}
-
return true;
});
}
@@ -84,6 +77,7 @@ export class ProxyViewContainer extends LayoutBase {
});
}
}
+
_tearDownUI(force?: boolean) {
super._tearDownUI(force);
if (this.reusable && !force) {
@@ -124,7 +118,6 @@ export class ProxyViewContainer extends LayoutBase {
if (atIndex !== undefined) {
insideIndex = this._childIndexToNativeChildIndex(atIndex);
} else {
- // Add last;
insideIndex = this._getNativeViewsCount();
}
if (Trace.isEnabled()) {
@@ -149,12 +142,6 @@ export class ProxyViewContainer extends LayoutBase {
}
}
- /*
- * Some layouts (e.g. GridLayout) need to get notified when adding and
- * removing children, so that they can update private measure data.
- *
- * We register our children with the parent to avoid breakage.
- */
public _registerLayoutChild(child: View) {
const parent = this.parent;
if (parent instanceof LayoutBase) {
@@ -169,11 +156,7 @@ export class ProxyViewContainer extends LayoutBase {
}
}
- /*
- * Register/unregister existing children with the parent layout.
- */
public _parentChanged(oldParent: View): void {
- // call super in order to execute base logic like clear inherited properties, etc.
super._parentChanged(oldParent);
const addingToParent = this.parent && !oldParent;
const newLayout = this.parent;
@@ -182,48 +165,37 @@ export class ProxyViewContainer extends LayoutBase {
if (addingToParent && newLayout instanceof LayoutBase) {
this.eachLayoutChild((child) => {
newLayout._registerLayoutChild(child);
-
return true;
});
} else if (oldLayout instanceof LayoutBase) {
this.eachLayoutChild((child) => {
oldLayout._unregisterLayoutChild(child);
-
return true;
});
}
}
- /**
- * Layout property changed, proxy the new value to the child view(s)
- */
- public _changedLayoutProperty(propName: string, value: string) {
+ public _changedLayoutProperty(propName: string, value: any) {
const numChildren = this._getNativeViewsCount();
if (numChildren > 1) {
- Trace.write("ProxyViewContainer._changeLayoutProperty - you're setting '" + propName + "' for " + this + ' with more than one child. Probably this is not what you want, consider wrapping it in a StackLayout ', Trace.categories.ViewHierarchy, Trace.messageType.error);
+ Trace.write("ProxyViewContainer._changeLayoutProperty - you're setting '" + propName + "' for " + this + ' with more than one child. Consider wrapping it in a StackLayout ', Trace.categories.ViewHierarchy, Trace.messageType.error);
}
this.eachLayoutChild((child) => {
this._applyLayoutPropertyToChild(child, propName, value);
-
return true;
});
this.proxiedLayoutProperties.add(propName);
}
- /**
- * Apply the layout property to the child view.
- */
private _applyLayoutPropertyToChild(child: View, propName: string, value: any) {
const proxyPropName = makeProxyPropName(propName);
if (proxyPropName in child) {
if (child[propName] !== child[proxyPropName]) {
- // Value was set directly on the child view, don't override.
if (Trace.isEnabled()) {
Trace.write('ProxyViewContainer._applyLayoutPropertyToChild child ' + child + ' has its own value [' + child[propName] + '] for [' + propName + ']', Trace.categories.ViewHierarchy);
}
-
return;
}
}
@@ -231,60 +203,31 @@ export class ProxyViewContainer extends LayoutBase {
child[propName] = value;
child[proxyPropName] = value;
}
+
+ // @ts-ignore
public set hidden(value: boolean) {
- super.hidden = value;
- this.eachChildView((child) => {
- child.hidden = value;
- return true;
- });
+ this.eachChildView((child) => {
+ child.hidden = value;
+ return true;
+ });
+ }
}
-}
+// Layout properties to be proxied to the child views
+const layoutProperties = ['left', 'top', 'dock', 'flexDirection', 'flexWrap', 'justifyContent', 'alignItems', 'alignContent', 'order', 'flexGrow', 'flexShrink', 'flexWrapBefore', 'alignSelf', 'flexFlow', 'flex', 'column', 'columnSpan', 'col', 'colSpan', 'row', 'rowSpan'];
-// Layout propeties to be proxyed to the child views
-const layoutProperties = [
- // AbsoluteLayout
- 'left',
- 'top',
-
- // DockLayout
- 'dock',
-
- // FlexLayout
- 'flexDirection',
- 'flexWrap',
- 'justifyContent',
- 'alignItems',
- 'alignContent',
- 'order',
- 'flexGrow',
- 'flexShrink',
- 'flexWrapBefore',
- 'alignSelf',
- 'flexFlow',
- 'flex',
-
- // GridLayout
- 'column',
- 'columnSpan',
- 'col',
- 'colSpan',
- 'row',
- 'rowSpan',
-];
-
-// Override the inherited layout properties
for (const name of layoutProperties) {
- const proxyProperty = new Property({
+ // CORRECTION: Changed Property<..., string> to Property<..., any>
+ const proxyProperty = new Property({
name,
valueChanged(target, oldValue, value) {
target._changedLayoutProperty(name, value);
},
});
-
proxyProperty.register(ProxyViewContainer);
}
-function makeProxyPropName(propName) {
+// CORRECTION: Added types for the function parameter and return value
+function makeProxyPropName(propName: string): string {
return `_proxy:${propName}`;
}
From 1193db8a67aa6592e0811b185d8ebabd0e95f6bc Mon Sep 17 00:00:00 2001
From: "kinglokesh2203gmail.com"
Date: Tue, 4 Nov 2025 21:16:27 +0530
Subject: [PATCH 3/5] fix(core): add hidden setter for ProxyViewContainer
From 73fc52c859e05bc4a4230bf314e9e02144810ab8 Mon Sep 17 00:00:00 2001
From: "kinglokesh2203gmail.com"
Date: Tue, 4 Nov 2025 21:39:05 +0530
Subject: [PATCH 4/5] fix(core): ensure ProxyViewContainer.hidden properly
hides child views (#10913)
---
.../core/ui/proxy-view-container/index.ts | 46 +++++++++----------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/packages/core/ui/proxy-view-container/index.ts b/packages/core/ui/proxy-view-container/index.ts
index f555f1b5a7..1ab6ff8b94 100644
--- a/packages/core/ui/proxy-view-container/index.ts
+++ b/packages/core/ui/proxy-view-container/index.ts
@@ -24,38 +24,36 @@ export class ProxyViewContainer extends LayoutBase {
}
// No native view for proxy container.
- // @ts-ignore
- get ios(): any {
+ public override get ios(): any {
return null;
}
- // @ts-ignore
- get android(): any {
+ public override get android(): any {
return null;
}
- get isLayoutRequested(): boolean {
+ public get isLayoutRequested(): boolean {
// Always return false so all layout requests from children bubble up.
return false;
}
- public createNativeView() {
+ public createNativeView(): any {
return undefined;
}
public _getNativeViewsCount(): number {
let result = 0;
- this.eachChildView((cv) => {
- result += cv._getNativeViewsCount();
+ this.eachChildView((cv: View) => {
+ result += (cv as any)._getNativeViewsCount();
return true;
});
return result;
}
- public _eachLayoutView(callback: (View) => void): void {
- this.eachChildView((cv) => {
+ public _eachLayoutView(callback: (view: View) => void): void {
+ this.eachChildView((cv: View) => {
if (!cv.isCollapsed) {
- cv._eachLayoutView(callback);
+ (cv as any)._eachLayoutView(callback);
}
return true;
});
@@ -99,10 +97,10 @@ export class ProxyViewContainer extends LayoutBase {
layoutProperties.forEach((propName) => {
const proxyPropName = makeProxyPropName(propName);
- child[proxyPropName] = child[propName];
+ (child as any)[proxyPropName] = (child as any)[propName];
if (this.proxiedLayoutProperties.has(propName)) {
- this._applyLayoutPropertyToChild(child, propName, this[propName]);
+ this._applyLayoutPropertyToChild(child, propName, (this as any)[propName]);
}
});
@@ -138,7 +136,8 @@ export class ProxyViewContainer extends LayoutBase {
const parent = this.parent;
if (parent instanceof View) {
- return parent._removeViewFromNativeVisualTree(child);
+ parent._removeViewFromNativeVisualTree(child);
+ return;
}
}
@@ -191,23 +190,24 @@ export class ProxyViewContainer extends LayoutBase {
private _applyLayoutPropertyToChild(child: View, propName: string, value: any) {
const proxyPropName = makeProxyPropName(propName);
- if (proxyPropName in child) {
- if (child[propName] !== child[proxyPropName]) {
+ const childAny = child as any;
+
+ if (proxyPropName in childAny) {
+ if (childAny[propName] !== childAny[proxyPropName]) {
if (Trace.isEnabled()) {
- Trace.write('ProxyViewContainer._applyLayoutPropertyToChild child ' + child + ' has its own value [' + child[propName] + '] for [' + propName + ']', Trace.categories.ViewHierarchy);
+ Trace.write('ProxyViewContainer._applyLayoutPropertyToChild child ' + child + ' has its own value [' + childAny[propName] + '] for [' + propName + ']', Trace.categories.ViewHierarchy);
}
return;
}
}
- child[propName] = value;
- child[proxyPropName] = value;
+ childAny[propName] = value;
+ childAny[proxyPropName] = value;
}
- // @ts-ignore
- public set hidden(value: boolean) {
- this.eachChildView((child) => {
- child.hidden = value;
+ public override set hidden(value: boolean): void {
+ this.eachChildView((child: View) => {
+ (child as any).hidden = value;
return true;
});
}
From 15fbca80e99a14fe67adbe0f53a63fc9b7b72a0b Mon Sep 17 00:00:00 2001
From: Nathan Walker
Date: Wed, 5 Nov 2025 11:10:32 -0800
Subject: [PATCH 5/5] chore: cleanup
---
packages/core/ui/proxy-view-container/index.ts | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/packages/core/ui/proxy-view-container/index.ts b/packages/core/ui/proxy-view-container/index.ts
index 1ab6ff8b94..8a948a01d8 100644
--- a/packages/core/ui/proxy-view-container/index.ts
+++ b/packages/core/ui/proxy-view-container/index.ts
@@ -217,7 +217,6 @@ export class ProxyViewContainer extends LayoutBase {
const layoutProperties = ['left', 'top', 'dock', 'flexDirection', 'flexWrap', 'justifyContent', 'alignItems', 'alignContent', 'order', 'flexGrow', 'flexShrink', 'flexWrapBefore', 'alignSelf', 'flexFlow', 'flex', 'column', 'columnSpan', 'col', 'colSpan', 'row', 'rowSpan'];
for (const name of layoutProperties) {
- // CORRECTION: Changed Property<..., string> to Property<..., any>
const proxyProperty = new Property({
name,
valueChanged(target, oldValue, value) {
@@ -227,7 +226,6 @@ for (const name of layoutProperties) {
proxyProperty.register(ProxyViewContainer);
}
-// CORRECTION: Added types for the function parameter and return value
-function makeProxyPropName(propName: string): string {
+function makeProxyPropName(propName: string) {
return `_proxy:${propName}`;
}
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/NativeScript/NativeScript/pull/10913.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy