@@ -125,7 +125,8 @@ export class ViewNode {
125125 ( < any > this . parentNativeView ) . _addChildFromBuilder ( this . viewName , this . nativeView ) ;
126126 this . attachUIEvents ( ) ;
127127 } else {
128- throw new Error ( "Parent view can't have children! " + this . _parentView ) ;
128+ console . log ( 'parentNativeView: ' + this . parentNativeView ) ;
129+ throw new Error ( "Parent view can't have children! " + this . parentNativeView ) ;
129130 }
130131 }
131132
@@ -159,6 +160,12 @@ export class ViewNode {
159160 }
160161
161162 public setAttribute ( attributeName : string , value : any ) : void {
163+ if ( ! this . nativeView ) {
164+ console . log ( 'Native view not created. Delaying attribute set: ' + attributeName ) ;
165+ this . attributes [ attributeName ] = value ;
166+ return ;
167+ }
168+
162169 console . log ( 'Setting attribute: ' + attributeName ) ;
163170
164171 let specialSetter = getSpecialPropertySetter ( attributeName ) ;
@@ -254,7 +261,7 @@ export class ViewNode {
254261 return this . children . indexOf ( childNode ) ;
255262 }
256263
257- setProperty ( name : string , value : any ) {
264+ public setProperty ( name : string , value : any ) {
258265 console . log ( 'ViewNode.setProperty ' + this . viewName + ' setProperty ' + name + ' ' + value ) ;
259266 if ( this . nativeView ) {
260267 this . setAttribute ( name , value ) ;
@@ -287,3 +294,17 @@ export class ViewNode {
287294 }
288295
289296}
297+
298+ export class DummyViewNode extends ViewNode {
299+ constructor ( public parentNode : ViewNode ) {
300+ super ( parentNode , null , { } ) ;
301+ }
302+ public attachToView ( atIndex : number = - 1 ) {
303+ }
304+ public insertChildAt ( index : number , childNode : ViewNode ) {
305+ }
306+ public removeChild ( childNode : ViewNode ) {
307+ }
308+ setProperty ( name : string , value : any ) {
309+ }
310+ }
0 commit comments