mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
Fixes #1691.
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import bindable = require("ui/core/bindable");
|
||||
import dependencyObservable = require("ui/core/dependency-observable");
|
||||
import definition = require("ui/core/proxy");
|
||||
import * as platform from "platform";
|
||||
import * as types from "utils/types";
|
||||
import * as observable from "data/observable";
|
||||
|
||||
@ -71,13 +70,20 @@ export class ProxyObject extends bindable.Bindable implements definition.ProxyOb
|
||||
this._eachSetProperty(eachPropertyCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the proxied native object has been created and properties may be applied to it.
|
||||
*/
|
||||
protected _canApplyNativeProperty(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
private _trySetNativeValue(property: dependencyObservable.Property, oldValue?:any, newValue?: any) {
|
||||
if (this._updatingJSPropertiesDict[property.name]) {
|
||||
// This is the case when a property has changed from the native side directly and we have received the "_onPropertyChanged" event while synchronizing our local cache
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform.device.os === platform.platformNames.android && !this.android) {
|
||||
if (!this._canApplyNativeProperty()) {
|
||||
// in android we have lazy loading and we do not have a native widget created yet, do not call the onSetNativeValue callback
|
||||
// properties will be synced when the widget is created
|
||||
return;
|
||||
|
@ -1165,4 +1165,9 @@ export class View extends ProxyObject implements definition.View {
|
||||
public _onStylePropertyChanged(property: Property): void {
|
||||
//
|
||||
}
|
||||
|
||||
protected _canApplyNativeProperty(): boolean {
|
||||
// Check for a valid _nativeView instance
|
||||
return !!this._nativeView;
|
||||
}
|
||||
}
|
||||
|
@ -47,11 +47,12 @@ export class Source {
|
||||
}
|
||||
}
|
||||
|
||||
export class ScopeError implements Error {
|
||||
export class ScopeError extends Error {
|
||||
private _child: Error;
|
||||
private _message: string;
|
||||
|
||||
constructor(child: Error, message?: string) {
|
||||
constructor(child: Error, message?: string) {
|
||||
super(message);
|
||||
if (!child) {
|
||||
throw new Error("Required child error!");
|
||||
}
|
||||
|
Reference in New Issue
Block a user