File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1
1
import bindable = require( "ui/core/bindable" ) ;
2
2
import dependencyObservable = require( "ui/core/dependency-observable" ) ;
3
3
import definition = require( "ui/core/proxy" ) ;
4
- import * as platform from "platform" ;
5
4
import * as types from "utils/types" ;
6
5
import * as observable from "data/observable" ;
7
6
@@ -71,13 +70,20 @@ export class ProxyObject extends bindable.Bindable implements definition.ProxyOb
71
70
this . _eachSetProperty ( eachPropertyCallback ) ;
72
71
}
73
72
73
+ /**
74
+ * Checks whether the proxied native object has been created and properties may be applied to it.
75
+ */
76
+ protected _canApplyNativeProperty ( ) : boolean {
77
+ return false ;
78
+ }
79
+
74
80
private _trySetNativeValue ( property : dependencyObservable . Property , oldValue ?:any , newValue ?: any ) {
75
81
if ( this . _updatingJSPropertiesDict [ property . name ] ) {
76
82
// 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
77
83
return ;
78
84
}
79
85
80
- if ( platform . device . os === platform . platformNames . android && ! this . android ) {
86
+ if ( ! this . _canApplyNativeProperty ( ) ) {
81
87
// in android we have lazy loading and we do not have a native widget created yet, do not call the onSetNativeValue callback
82
88
// properties will be synced when the widget is created
83
89
return ;
Original file line number Diff line number Diff line change @@ -1165,4 +1165,9 @@ export class View extends ProxyObject implements definition.View {
1165
1165
public _onStylePropertyChanged ( property : Property ) : void {
1166
1166
//
1167
1167
}
1168
+
1169
+ protected _canApplyNativeProperty ( ) : boolean {
1170
+ // Check for a valid _nativeView instance
1171
+ return ! ! this . _nativeView ;
1172
+ }
1168
1173
}
Original file line number Diff line number Diff line change @@ -47,11 +47,12 @@ export class Source {
47
47
}
48
48
}
49
49
50
- export class ScopeError implements Error {
50
+ export class ScopeError extends Error {
51
51
private _child : Error ;
52
52
private _message : string ;
53
53
54
- constructor ( child : Error , message ?: string ) {
54
+ constructor ( child : Error , message ?: string ) {
55
+ super ( message ) ;
55
56
if ( ! child ) {
56
57
throw new Error ( "Required child error!" ) ;
57
58
}
You can’t perform that action at this time.
0 commit comments