8000 CssAnimationProperty will register the same way CssProperty in the sy… · Cayan/NativeScript@23658c9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 23658c9

Browse files
committed
CssAnimationProperty will register the same way CssProperty in the symbol maps and will register on the style with css name too
1 parent fd6c84a commit 23658c9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tns-core-modules/ui/core/properties.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ export const unsetValue: any = new Object();
1010
let symbolPropertyMap = {};
1111
let cssSymbolPropertyMap = {};
1212

13-
let cssSymbolResetMap = {};
14-
1513
let inheritableProperties = new Array<InheritedProperty<any, any>>();
1614
let inheritableCssProperties = new Array<InheritedCssProperty<any, any>>();
1715

@@ -559,9 +557,10 @@ export class CssAnimationProperty<T extends Style, U> {
559557
const { valueConverter, equalityComparer, valueChanged, defaultValue } = options;
560558
const propertyName = options.name;
561559
this.name = propertyName;
562-
this.cssName = (options.cssName || propertyName);
563560

564561
const cssName = "css:" + (options.cssName || propertyName);
562+
this.cssName = cssName;
563+
565564
const keyframeName = "keyframe:" + propertyName;
566565
this.keyframe = keyframeName;
567566
const defaultName = "default:" + propertyName;
@@ -623,10 +622,8 @@ export class CssAnimationProperty<T extends Style, U> {
623622
const stylePropertyDescriptor = descriptor(styleValue, ValueSource.Local, true, true, true);
624623
const keyframePropertyDescriptor = descriptor(keyframeValue, ValueSource.Keyframe, false, false, false);
625624

626-
cssSymbolResetMap[cssValue] = cssName;
627-
cssSymbolResetMap[keyframeValue] = keyframeName;
628-
629625
symbolPropertyMap[computedValue] = this;
626+
cssSymbolPropertyMap[computedValue] = this;
630627

631628
this.register = (cls: { prototype: T }) => {
632629
cls.prototype[defaultValueKey] = options.defaultValue;
@@ -640,6 +637,9 @@ export class CssAnimationProperty<T extends Style, U> {
640637
Object.defineProperty(cls.prototype, defaultName, defaultPropertyDescriptor);
641638
Object.defineProperty(cls.prototype, cssName, cssPropertyDescriptor);
642639
Object.defineProperty(cls.prototype, propertyName, stylePropertyDescriptor);
640+
if (options.cssName && options.cssName != options.name) {
641+
Object.defineProperty(cls.prototype, options.cssName, stylePropertyDescriptor);
642+
}
643643
Object.defineProperty(cls.prototype, keyframeName, keyframePropertyDescriptor);
644644
}
645645
}
@@ -979,8 +979,9 @@ export function resetCSSProperties(style: Style): void {
979979
let cssProperty;
980980
if (cssProperty = cssSymbolPropertyMap[symbol]) {
981981
style[cssProperty.cssName] = unsetValue;
982-
} else if (cssProperty = cssSymbolResetMap[symbol]) {
983-
style[cssProperty] = unsetValue;
982+
if (cssProperty instanceof CssAnimationProperty) {
983+
style[cssProperty.keyframe] = unsetValue;
4A31 984+
}
984985
}
985986
}
986987
}

0 commit comments

Comments
 (0)
0