NativeScript / nativescript-angular

Integrating NativeScript with Angular
http://docs.nativescript.org/angular/tutorial/ng-chapter-0
Apache License 2.0
1.21k stars 241 forks source link

iosEstimatedRowHeight crashes iOS app #1456

Open tucazinul opened 6 years ago

tucazinul commented 6 years ago

Hi,

I have two ListViews on different routes, to which I set iosEstimatedRowHeight = 0 and rowHeight = -1. The first time I reach those pages everything works great. The second time however (Page 1 -> Page 2 -> Page 1) it crashes with the message:

ns-list-view: ViewReference not found for item 1. View recycling is not working

On android everything works and also on iOS if i remove the iosEstimatedRowHeight property. But I need that property to avoid scroll issues.

This is how I set the properties in the components:

onListViewLoaded(args): void {
  this.listView = args.object;
  if (isIOS) {
     this.listView.ios.allowsSelection = false;
     this.listView.rowHeight = -1;
     this.listView.iosEstimatedRowHeight = 0;
 }
}

The html it's kinda like this:

<StackLayout height="100%">
  <StackLayout class="body">
        <ListView separatorColor="#fafafc" (loaded)="onListViewLoaded($event)" (loadMoreItems)="loadMoreItems()" [items]="itemsArray" >
          <ng-template let-item="item">
                <Label textWrap="true" class="title" [text]="item.title"></Label>
          </ng-template>
        </ListView>
  </StackLayout>
</StackLayout>

package.json:

"dependencies": { "@angular/animations": "^5.2.11", "@angular/common": "^5.2.11", "@angular/compiler": "^5.2.11", "@angular/core": "^5.2.11", "@angular/forms": "^5.2.11", "@angular/http": "^5.2.11", "@angular/platform-browser": "^5.2.11", "@angular/platform-browser-dynamic": "^5.2.11", "@angular/router": "^5.2.11", "base-64": "^0.1.0", "nativescript-angular": "~5.2.0", "nativescript-cardview": "^2.0.5", "nativescript-drop-down": "^4.0.0", "nativescript-feedback": "^1.2.0", "nativescript-iqkeyboardmanager": "^1.3.0", "nativescript-ngx-shadow": "^6.0.0", "nativescript-orientation": "^2.2.0", "nativescript-platform-css": "^1.6.5", "nativescript-theme-core": "~1.0.4", "nativescript-ui-sidedrawer": "^4.1.1", "nativescript-urlhandler": "^1.2.2", "nativescript-videoplayer": "^3.1.0", "nativescript-websockets": "^1.5.0", "reflect-metadata": "~0.1.8", "rxjs": "^5.5.11", "tns-core-modules": "^4.1.0", "utf8": "^3.0.0", "zone.js": "^0.8.26" }, "devDependencies": { "@angular/compiler-cli": "^5.2.11", "@ngtools/webpack": "~1.9.4", "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", "copy-webpack-plugin": "~4.3.0", "css-loader": "^0.28.11", "extract-text-webpack-plugin": "~3.0.2", "lazy": "1.0.11", "nativescript-dev-typescript": "~0.6.0", "nativescript-dev-webpack": "^0.9.2", "nativescript-worker-loader": "~0.8.1", "node-sass": "^4.9.0", "raw-loader": "~0.5.1", "resolve-url-loader": "~2.2.1", "sass-loader": "^7.0.3", "tns-platform-declarations": "^3.4.1", "typescript": "~2.6.2", "uglifyjs-webpack-plugin": "~1.1.6", "webpack": "~3.10.0", "webpack-bundle-analyzer": "^2.13.1", "webpack-sources": "~1.1.0" }

Please ask for more details, I don't know what else could be useful.

tucazinul commented 6 years ago

Btw this is the error trace:

ns-list-view: ViewReference not found for item 1. View recycling is not working Fatal JavaScript exception - application has been terminated. JavaScript stack trace: 1 createEmbeddedView@file:///app/bundle.js:1:81163 2 onItemLoading@file:///app/bundle.js:1:561489 3 notify@file:///app/bundle.js:1:504910 4 p@file:///app/bundle.js:1:1264475 5 _prepareCell@file:///app/bundle.js:1:1270846 6 tableViewHeightForRowAtIndexPath@file:///app/bundle.js:1:1266509 7 reloadData@[native code] 8 refresh@file:///app/bundle.js:1:1269311 9 valueChanged@file:///app/bundle.js:1:994550 10 set@file:///app/bundle.js:1:367127 11 set@file:///app/bundle.js:1:560128 12 Ri@file:///app/bundle.js:1:91536 13 @file:///app/bundle.js:1:102764 14 Ga@file:///app/bundle.js:1:113386 15 @file:///app/bundle.js:1:112952 16 @file:///app/bundle.js:1:1473545 17 aa@file:///app/bundle.js:1:101189 18 ya@file:///app/bundle.js:1:107921 19 ha@file:///app/bundle.js:1:107319 20 aa@file:///app/bundle.js:1:101319 21 ya@file:///app/bundle.js:1:107921 22 fa@file:///app/bundle.js:1:107584 23 aa@file:///app/bundle.js:1:101197 24 ya@file:///app/bundle.js:1:107921 25 ha@file:///app/bundle.js:1:107319 26 aa@file:///app/bundle.js:1:101319 27 ya@file:///app/bundle.js:1:107921 28 fa@file:///app/bundle.js:1:107584 29 aa@file:///app/bundle.js:1:101197 30 ya@file:///app/bundle.js:1:107921 31 fa@file:///app/bundle.js:1:107584 32 aa@file:///app/bundle.js:1:101197 33 ya@file:///app/bundle.js:1:107921 34 ha@file:///app/bundle.js:1:107319 35 aa@file:///app/bundle.js:1:101319 36 es@file:///app/bundle.js:1:117120 37 detectChanges@file:///app/bundle.js:1:82918 38 forEach@[native code] 39 tick@file:///app/bundle.js:1:45250 40 @file:///app/bundle.js:1:43591 41 onInvoke@file:///app/bundle.js:1:35501 42 run@file:///app/bundle.js:1:914536 43 next@file:///app/bundle.js:1:43573 44 @file:///app/bundle.js:1:34091 45 __tryOrUnsub@file:///app/bundle.js:1:198710 46 next@file:///app/bundle.js:1:197996 47 _next@file:///app/bundle.js:1:197039 48 next@file:///app/bundle.js:1:196711 49 next@file:///app/bundle.js:1:381657 50 emit@file:///app/bundle.js:1:33872 51 Yt@file:///app/bundle.js:1:36672 52 onHasTask@file:///app/bundle.js:1:35640 53 hasTask@file:///app/bundle.js:1:920677 54 _updateTaskCount@file:///app/bundle.js:1:921002 55 updateTaskCount@file:///app/bundle.js:1:917078 56 runTask@file:///app/bundle.js:1:915478 57 @file:///app/bundle.js:1:923137 58 promiseReactionJob@[native code] 59 UIApplicationMain@[native code] 60 m@file:///app/bundle.js:1:280271 61 bootstrapApp@file:///app/bundle.js:1:1116251 62 bootstrapModuleFactory@file:///app/bundle.js:1:1115797 63 @file:///app/bundle.js:1:1114388 64 t@file:///app/vendor.js:1:498 65 webpackJsonp@file:///app/vendor.js:1:369 66 anonymous@file:///app/bundle.js:1:98 67 evaluate@[native code] 68 moduleEvaluation@[native code] 69 @[native code] 70 promiseReactionJob@[native code] 71 require@[native code] 72 anonymous@file:///app/starter.js:2:8 73 evaluate@[native code] 74 moduleEvaluation@[native code] 75 @[native code] 76 promiseReactionJob@[native code] JavaScript error: file:///app/bundle.js:1:81163: JS ERROR TypeError: undefined is not an object (evaluating 'e.createEmbeddedView')

neversaynever44 commented 4 years ago

any news?