mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Fixed pseudoselectors to work with Angular
This commit is contained in:
@ -7,6 +7,7 @@ import utils = require("utils/utils");
|
||||
import enums = require("ui/enums");
|
||||
import dependencyObservable = require("ui/core/dependency-observable");
|
||||
import styleScope = require("../styling/style-scope");
|
||||
import {Property} from "ui/core/dependency-observable";
|
||||
|
||||
class TapHandlerImpl extends NSObject {
|
||||
private _owner: WeakRef<Button>;
|
||||
@ -50,13 +51,7 @@ export class Button extends common.Button {
|
||||
|
||||
public onLoaded() {
|
||||
super.onLoaded();
|
||||
if (this.parent !== null && this.page !== null) {
|
||||
let rootPage = this.page;
|
||||
let scope: styleScope.StyleScope = (<any>rootPage)._getStyleScope();
|
||||
if (scope.getVisualStates(this) !== undefined) {
|
||||
this._stateChangedHandler.start();
|
||||
}
|
||||
}
|
||||
this._updateHandler();
|
||||
}
|
||||
|
||||
public onUnloaded() {
|
||||
@ -64,6 +59,13 @@ export class Button extends common.Button {
|
||||
this._stateChangedHandler.stop();
|
||||
}
|
||||
|
||||
public _onPropertyChanged(property: Property, oldValue: any, newValue: any) {
|
||||
super._onPropertyChanged(property, oldValue, newValue);
|
||||
if (property.metadata.affectsStyle) {
|
||||
this._updateHandler();
|
||||
}
|
||||
}
|
||||
|
||||
get ios(): UIButton {
|
||||
return this._ios;
|
||||
}
|
||||
@ -81,10 +83,23 @@ export class Button extends common.Button {
|
||||
// the UIControlStateNormal value. If the value for UIControlStateNormal is not set,
|
||||
// then the property defaults to a system value. Therefore, at a minimum, you should
|
||||
// set the value for the normal state.
|
||||
var newText = value ? value._formattedText : null;
|
||||
let newText = value ? value._formattedText : null;
|
||||
this.ios.setAttributedTitleForState(newText, UIControlState.UIControlStateNormal);
|
||||
this.style._updateTextDecoration();
|
||||
}
|
||||
|
||||
private _updateHandler() {
|
||||
if (this.parent !== null && this.page !== null) {
|
||||
let rootPage = this.page;
|
||||
let scope: styleScope.StyleScope = (<any>rootPage)._getStyleScope();
|
||||
if (scope.getVisualStates(this) !== undefined) {
|
||||
this._stateChangedHandler.start();
|
||||
}
|
||||
else {
|
||||
this._stateChangedHandler.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class ButtonStyler implements style.Styler {
|
||||
|
@ -894,8 +894,7 @@ export class View extends ProxyObject implements definition.View {
|
||||
if (!rootPage || !rootPage.isLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
var scope: styleScope.StyleScope = (<any>rootPage)._getStyleScope()
|
||||
var scope: styleScope.StyleScope = (<any>rootPage)._getStyleScope();
|
||||
scope.applySelectors(this);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user