mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix Repeater
This commit is contained in:
@@ -546,7 +546,7 @@ export class CssProperty<T extends Style, U> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U> {
|
export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U> {
|
||||||
public setInhertiedValue: (value: U) => void;
|
public setInheritedValue: (value: U) => void;
|
||||||
|
|
||||||
constructor(options: CssPropertyOptions<T, U>) {
|
constructor(options: CssPropertyOptions<T, U>) {
|
||||||
super(options);
|
super(options);
|
||||||
@@ -662,7 +662,7 @@ export class InheritedCssProperty<T extends Style, U> extends CssProperty<T, U>
|
|||||||
const setDefaultFunc = setFunc(ValueSource.Default);
|
const setDefaultFunc = setFunc(ValueSource.Default);
|
||||||
const setInheritedFunc = setFunc(ValueSource.Inherited);
|
const setInheritedFunc = setFunc(ValueSource.Inherited);
|
||||||
|
|
||||||
this.setInhertiedValue = setInheritedFunc;
|
this.setInheritedValue = setInheritedFunc;
|
||||||
this.cssValueDescriptor.set = setFunc(ValueSource.Css);
|
this.cssValueDescriptor.set = setFunc(ValueSource.Css);
|
||||||
this.localValueDescriptor.set = setFunc(ValueSource.Local);
|
this.localValueDescriptor.set = setFunc(ValueSource.Local);
|
||||||
|
|
||||||
@@ -829,7 +829,7 @@ export function clearInheritedProperties(view: ViewBase): void {
|
|||||||
for (let prop of inheritableCssProperties) {
|
for (let prop of inheritableCssProperties) {
|
||||||
const sourceKey = prop.sourceKey;
|
const sourceKey = prop.sourceKey;
|
||||||
if (style[sourceKey] === ValueSource.Inherited) {
|
if (style[sourceKey] === ValueSource.Inherited) {
|
||||||
prop.setInhertiedValue.call(style, unsetValue);
|
prop.setInheritedValue.call(style, unsetValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -878,7 +878,7 @@ export function propagateInheritedProperties(view: ViewBase): void {
|
|||||||
const style = child.style;
|
const style = child.style;
|
||||||
const currentValueSource: number = style[sourceKey] || ValueSource.Default;
|
const currentValueSource: number = style[sourceKey] || ValueSource.Default;
|
||||||
if (currentValueSource <= ValueSource.Inherited) {
|
if (currentValueSource <= ValueSource.Inherited) {
|
||||||
prop.setInhertiedValue.call(style, pair.value, ValueSource.Inherited);
|
prop.setInheritedValue.call(style, pair.value, ValueSource.Inherited);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,15 +150,15 @@ itemsProperty.register(Repeater);
|
|||||||
export const itemsLayoutProperty = new Property<Repeater, LayoutBase>({
|
export const itemsLayoutProperty = new Property<Repeater, LayoutBase>({
|
||||||
name: "itemsLayout", affectsLayout: true, valueChanged: (target, oldValue, newValue) => {
|
name: "itemsLayout", affectsLayout: true, valueChanged: (target, oldValue, newValue) => {
|
||||||
if (oldValue) {
|
if (oldValue) {
|
||||||
this._removeView(oldValue);
|
target._removeView(oldValue);
|
||||||
oldValue.removeChildren();
|
oldValue.removeChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
this._addView(newValue);
|
target._addView(newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._requestRefresh();
|
target._requestRefresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
itemsLayoutProperty.register(Repeater);
|
itemsLayoutProperty.register(Repeater);
|
||||||
Reference in New Issue
Block a user