Error: View not added to this instance. View: Label(209) CurrentParent: Pager(202) ExpectedParent: DockLayout(185)


#1

Hello,

After updating the app to Nativescript 3.1.3 I found this issue on iOS and I can’t find a solution.
Click on tab where I have the code below and then click on any button I get the error bellow.

Enviroment :
CLI : 3.1.3
tns-core-modules : 3.1.0
tns-ios : 3.1.0
nativescript-pager : ^5.0.2

Component :

<StackLayout>
    <DockLayout stretchLastChild="true" height="100%">
      <Pager dock="top" [items]="allProfiles | async" #pager [selectedIndex]="currentPagerIndex" (selectedIndexChanged)="onIndexChanged($event)" class="pager">
            <ng-template pagerItemTemplate let-i="index" let-card="item">
                <StackLayout>
                    <Label text="Hello"></Label> <!-- this is for test -->
                     <!--  in my code I have this  : 
                          <ProfileCard [data]="card"></ProfileCard> 
                      -->
                </StackLayout>
            </ng-template>
        </Pager>
     </DockLayout>
</StackLayout>

Error :

[Error] Error: Uncaught (in promise): Error: View not added to this instance. View: Label(209) CurrentParent: Pager(202) ExpectedParent: DockLayout(185)
_removeView@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:470:28 [angular]
removeChild@file:///app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js:53:25 [angular]
removeChild@file:///app/tns_modules/nativescript-angular/view-util.js:70:31 [angular]
removeChild@file:///app/tns_modules/nativescript-angular/renderer.js:82:34 [angular]
removeChild@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:13356:34 [angular]
execRenderNodeAction@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:9089:33 [angular]
visitRenderNode@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:9057:33 [angular]
visitSiblingRenderNodes@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:8988:28 [angular]
visitRootRenderNodes@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:8972:28 [angular]
renderDetachView@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:9793:25 [angular]
detachEmbeddedView@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:9731:21 [angular]
detach@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:10169:55 [angular]
destroy@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:10252:42 [angular]
file:///app/tns_modules/nativescript-pager/angular/index.js:16:24 [angular]
notify@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:103:31 [angular]
_emit@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:120:24 [angular]
onUnloaded@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:220:19 [angular]
file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:243:33 [angular]
file:///app/tns_modules/nativescript-pager/src/ios/pager.js:61:25 [angular]
forEach@[native code] [angular]
eachChildView@file:///app/tns_modules/nativescript-pager/src/ios/pager.js:60:34 [angular]
eachChild@file:///app/tns_modules/tns-core-modules/ui/core/view/view-common.js:690:27 [angular]
_unloadEachChild@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:241:23 [angular]
onUnloaded@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:218:30 [angular]
file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:243:33 [angular]
eachChildView@file:///app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js:125:34 [angular]
eachChild@file:///app/tns_modules/tns-core-modules/ui/core/view/view-common.js:690:27 [angular]
_unloadEachChild@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:241:23 [angular]
onUnloaded@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:218:30 [angular]
file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:243:33 [angular]
eachChildView@file:///app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js:125:34 [angular]
eachChild@file:///app/tns_modules/tns-core-modules/ui/core/view/view-common.js:690:27 [angular]
_unloadEachChild@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:241:23 [angular]
onUnloaded@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:218:30 [angular]
file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:243:33 [angular]
eachChildView@file:///app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js:125:34 [angular]
eachChild@file:///app/tns_modules/tns-core-modules/ui/core/view/view-common.js:690:27 [angular]
_unloadEachChild@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:241:23 [angular]
onUnloaded@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:218:30 [angular]
_removeViewCore@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:484:28 [angular]
_removeViewCore@file:///app/tns_modules/tns-core-modules/ui/core/view/view.js:27:46 [angular]
_removeView@file:///app/tns_modules/tns-core-modules/ui/core/view-base/view-base.js:475:29 [angular]
removeChild@file:///app/tns_modules/tns-core-modules/ui/layouts/layout-base-common.js:53:25 [angular]
removeChild@file:///app/tns_modules/nativescript-angular/view-util.js:70:31 [angular]
removeChild@file:///app/tns_modules/nativescript-angular/renderer.js:82:34 [angular]
removeChild@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:13356:34 [angular]
execRenderNodeAction@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:9089:33 [angular]
visitRenderNode@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:9057:33 [angular]
visitSiblingRenderNodes@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:8988:28 [angular]
visitRootRenderNodes@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:8972:28 [angular]
renderDetachView@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:9793:25 [angular]
detachEmbeddedView@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:9731:21 [angular]
detach@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:10169:55 [angular]
destroy@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:10252:42 [angular]
destroy@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:9999:74 [angular]
deactivate@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:5298:35 [angular]
deactiveRouteAndOutlet@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4578:30 [angular]
deactiveRouteAndItsChildren@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4538:40 [angular]
file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4571:50 [angular]
forEach@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:475:21 [angular]
deactiveRouteAndOutlet@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4569:16 [angular]
deactiveRouteAndItsChildren@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4538:40 [angular]
deactivateRoutes@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4467:49 [angular]
file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4429:35 [angular]
forEach@[native code] [angular]
deactivateChildRoutes@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4428:36 [angular]
activate@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4415:35 [angular]
file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4034:30 [angular]
file:///app/tns_modules/rxjs/Observable.js:110:25 [angular]
__tryOrSetError@file:///app/tns_modules/rxjs/Subscriber.js:247:20 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:187:42 [angular]
_next@file:///app/tns_modules/rxjs/Subscriber.js:125:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:49:28 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_complete@file:///app/tns_modules/rxjs/operator/reduce.js:119:34 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_complete@file:///app/tns_modules/rxjs/operator/mergeMap.js:135:38 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ArrayObservable.js:116:32 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyComplete@file:///app/tns_modules/rxjs/operator/every.js:53:30 [angular]
_complete@file:///app/tns_modules/rxjs/operator/every.js:70:28 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_complete@file:///app/tns_modules/rxjs/operator/mergeMap.js:135:38 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ArrayObservable.js:116:32 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyComplete@file:///app/tns_modules/rxjs/operator/every.js:53:30 [angular]
_complete@file:///app/tns_modules/rxjs/operator/every.js:70:28 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_complete@file:///app/tns_modules/rxjs/operator/mergeMap.js:135:38 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ArrayObservable.js:116:32 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:49:28 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:49:28 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/Subscriber.js:125:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_complete@file:///app/tns_modules/rxjs/operator/last.js:110:29 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_complete@file:///app/tns_modules/rxjs/operator/mergeAll.js:94:38 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:51:36 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
file:///app/tns_modules/rxjs/Observable.js:89:43 [angular]
forEach@file:///app/tns_modules/rxjs/Observable.js:85:31 [angular]
file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4015:25 [angular]
runNavigate@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:3946:27 [angular]
onInvoke@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:4156:43 [angular]
onInvokeTask@file:///app/tns_modules/@angular/core/./bundles/core.umd.js:4147:47 [angular]
promiseReactionJob@[native code] [<root>]
UIApplicationMain@[native code] [<root>]
start@file:///app/tns_modules/tns-core-modules/application/application.js:211:26 [<root>]
bootstrapApp@file:///app/tns_modules/nativescript-angular/platform-common.js:73:28 [<root>]
bootstrapModule@file:///app/tns_modules/nativescript-angular/platform-common.js:61:26 [<root>]
anonymous@file:///app/main.js:12:57 [<root>]
evaluate@[native code] [<root>]
moduleEvaluation@[native code] [<root>]
[native code] [<root>]
promiseReactionJob@[native code] [<root>] — zone-nativescript.js:993
	(anonymous function) (console.js:26)
	consoleError (zone-nativescript.js:571)
	handleUnhandledRejection (zone-nativescript.js:574)
	_loop_1 (zone-nativescript.js:609)
	drainMicroTaskQueue (zone-nativescript.js:613)
	promiseReactionJob
	UIApplicationMain
	start (application.js:211)
	bootstrapApp (platform-common.js:73)
	bootstrapModule (platform-common.js:61)
	anonymous (main.js:12)
	evaluate
	moduleEvaluation
	(anonymous function)
	promiseReactionJob

I guess it would be a problem with this plugin nativescript-pager but I can’t figure out what’s going on. Any help is greatly appreciated!


#2

Since it’s an issue with the plugin, I recommend posting this on the plugin’s ‘issues’ tab on the github repo. Not sure but possibly Josh or Triniwiz is the author? They should be able to help.