mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Unregister animations only once - on reset css
This commit is contained in:
@@ -10,14 +10,14 @@ import * as frameModule from "ui/frame";
|
|||||||
import proxy = require("ui/core/proxy");
|
import proxy = require("ui/core/proxy");
|
||||||
import keyframeAnimation = require("ui/animation/keyframe-animation");
|
import keyframeAnimation = require("ui/animation/keyframe-animation");
|
||||||
|
|
||||||
var fs: typeof fileSystemModule;
|
let fs: typeof fileSystemModule;
|
||||||
function ensureFS() {
|
function ensureFS() {
|
||||||
if (!fs) {
|
if (!fs) {
|
||||||
fs = require("file-system");
|
fs = require("file-system");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var frame: typeof frameModule;
|
let frame: typeof frameModule;
|
||||||
function ensureFrame() {
|
function ensureFrame() {
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
frame = require("ui/frame");
|
frame = require("ui/frame");
|
||||||
@@ -25,14 +25,14 @@ function ensureFrame() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// on Android we explicitly set propertySettings to None because android will invalidate its layout (skip unnecessary native call).
|
// on Android we explicitly set propertySettings to None because android will invalidate its layout (skip unnecessary native call).
|
||||||
var AffectsLayout = global.android ? PropertyMetadataSettings.None : PropertyMetadataSettings.AffectsLayout;
|
const AffectsLayout = global.android ? PropertyMetadataSettings.None : PropertyMetadataSettings.AffectsLayout;
|
||||||
|
|
||||||
var backgroundSpanUnderStatusBarProperty = new Property("backgroundSpanUnderStatusBar", "Page", new proxy.PropertyMetadata(false, AffectsLayout));
|
const backgroundSpanUnderStatusBarProperty = new Property("backgroundSpanUnderStatusBar", "Page", new proxy.PropertyMetadata(false, AffectsLayout));
|
||||||
|
|
||||||
var actionBarHiddenProperty = new Property("actionBarHidden", "Page", new proxy.PropertyMetadata(undefined, AffectsLayout));
|
const actionBarHiddenProperty = new Property("actionBarHidden", "Page", new proxy.PropertyMetadata(undefined, AffectsLayout));
|
||||||
|
|
||||||
function onActionBarHiddenPropertyChanged(data: PropertyChangeData) {
|
function onActionBarHiddenPropertyChanged(data: PropertyChangeData) {
|
||||||
var page = <Page>data.object;
|
const page = <Page>data.object;
|
||||||
if (page.isLoaded) {
|
if (page.isLoaded) {
|
||||||
page._updateActionBar(data.newValue);
|
page._updateActionBar(data.newValue);
|
||||||
}
|
}
|
||||||
@@ -167,8 +167,8 @@ export class Page extends ContentView implements dts.Page {
|
|||||||
}
|
}
|
||||||
if (!this._cssFiles[cssFileName]) {
|
if (!this._cssFiles[cssFileName]) {
|
||||||
if (fs.File.exists(cssFileName)) {
|
if (fs.File.exists(cssFileName)) {
|
||||||
var file = fs.File.fromPath(cssFileName);
|
const file = fs.File.fromPath(cssFileName);
|
||||||
var text = file.readTextSync();
|
const text = file.readTextSync();
|
||||||
if (text) {
|
if (text) {
|
||||||
this._addCssInternal(text, cssFileName);
|
this._addCssInternal(text, cssFileName);
|
||||||
this._cssFiles[cssFileName] = true;
|
this._cssFiles[cssFileName] = true;
|
||||||
@@ -224,11 +224,11 @@ export class Page extends ContentView implements dts.Page {
|
|||||||
this._showNativeModalView(<any>frame.topmost().currentPage, undefined, undefined, true);
|
this._showNativeModalView(<any>frame.topmost().currentPage, undefined, undefined, true);
|
||||||
return this;
|
return this;
|
||||||
} else {
|
} else {
|
||||||
var context: any = arguments[1];
|
const context: any = arguments[1];
|
||||||
var closeCallback: Function = arguments[2];
|
const closeCallback: Function = arguments[2];
|
||||||
var fullscreen: boolean = arguments[3];
|
const fullscreen: boolean = arguments[3];
|
||||||
|
|
||||||
var page: Page;
|
let page: Page;
|
||||||
if (arguments[0] instanceof Page) {
|
if (arguments[0] instanceof Page) {
|
||||||
page = <Page>arguments[0];
|
page = <Page>arguments[0];
|
||||||
} else {
|
} else {
|
||||||
@@ -261,7 +261,7 @@ export class Page extends ContentView implements dts.Page {
|
|||||||
|
|
||||||
protected _showNativeModalView(parent: Page, context: any, closeCallback: Function, fullscreen?: boolean) {
|
protected _showNativeModalView(parent: Page, context: any, closeCallback: Function, fullscreen?: boolean) {
|
||||||
parent._modal = this;
|
parent._modal = this;
|
||||||
var that = this;
|
const that = this;
|
||||||
this._modalContext = context;
|
this._modalContext = context;
|
||||||
this._closeModalCallback = function () {
|
this._closeModalCallback = function () {
|
||||||
if (that._closeModalCallback) {
|
if (that._closeModalCallback) {
|
||||||
@@ -285,7 +285,7 @@ export class Page extends ContentView implements dts.Page {
|
|||||||
object: this,
|
object: this,
|
||||||
context: this._modalContext,
|
context: this._modalContext,
|
||||||
closeCallback: this._closeModalCallback
|
closeCallback: this._closeModalCallback
|
||||||
}
|
};
|
||||||
this.notify(args);
|
this.notify(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,11 +319,11 @@ export class Page extends ContentView implements dts.Page {
|
|||||||
|
|
||||||
this._styleScope.ensureSelectors();
|
this._styleScope.ensureSelectors();
|
||||||
|
|
||||||
var scope = this._styleScope;
|
const scope = this._styleScope;
|
||||||
var checkSelectors = (view: view.View): boolean => {
|
const checkSelectors = (view: view.View): boolean => {
|
||||||
scope.applySelectors(view);
|
scope.applySelectors(view);
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
checkSelectors(this);
|
checkSelectors(this);
|
||||||
view.eachDescendant(this, checkSelectors);
|
view.eachDescendant(this, checkSelectors);
|
||||||
@@ -332,10 +332,10 @@ export class Page extends ContentView implements dts.Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _resetCssValues() {
|
private _resetCssValues() {
|
||||||
var resetCssValuesFunc = (view: view.View): boolean => {
|
const resetCssValuesFunc = (view: view.View): boolean => {
|
||||||
view.style._resetCssValues();
|
view.style._resetCssValues();
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
|
|
||||||
resetCssValuesFunc(this);
|
resetCssValuesFunc(this);
|
||||||
view.eachDescendant(this, resetCssValuesFunc);
|
view.eachDescendant(this, resetCssValuesFunc);
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ export class CssSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public apply(view: view.View, valueSourceModifier: number) {
|
public apply(view: view.View, valueSourceModifier: number) {
|
||||||
view._unregisterAllAnimations();
|
|
||||||
let modifier = valueSourceModifier || this.valueSourceModifier;
|
let modifier = valueSourceModifier || this.valueSourceModifier;
|
||||||
this.eachSetter((property, value) => {
|
this.eachSetter((property, value) => {
|
||||||
if (types.isString(property)) {
|
if (types.isString(property)) {
|
||||||
|
|||||||
@@ -890,7 +890,9 @@ export class Style extends DependencyObservable implements styling.Style {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public _resetCssValues() {
|
public _resetCssValues() {
|
||||||
var that = this;
|
this._view._unregisterAllAnimations();
|
||||||
|
|
||||||
|
const that = this;
|
||||||
this._eachSetProperty(function (property: Property) {
|
this._eachSetProperty(function (property: Property) {
|
||||||
that._resetValue(property, ValueSource.Css);
|
that._resetValue(property, ValueSource.Css);
|
||||||
return true;
|
return true;
|
||||||
@@ -898,7 +900,7 @@ export class Style extends DependencyObservable implements styling.Style {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public _resetLocalValues() {
|
public _resetLocalValues() {
|
||||||
var that = this;
|
const that = this;
|
||||||
this._eachSetProperty(function (property: Property) {
|
this._eachSetProperty(function (property: Property) {
|
||||||
that._resetValue(property);
|
that._resetValue(property);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user