nativescript-community / nativescript-community/ui-pager

An error occurs when transitioning to the 4th page on iOS

Open
#26 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
21
Forks
14
PR merge metrics
No merged PRs in 30d

Description

With ui-pager with 4 or more pages set, an error will occur if you move to the 4th page.
This only happens on iOS, not Android.

  page1 mounted
  page2 mounted
  page3 mounted
  page1 destroyed
  page4 mounted
***** Fatal JavaScript exception - application has been terminated. *****
  NativeScript encountered a fatal error: Uncaught TypeError: Cannot read property 'removeFromSuperview' of null
  at
  _prepareCell(file: app/webpack:/@nativescript/template-blank-vue-ts/node_modules/@nativescript-community/ui-pager/index.ios.js:635:0)
  at UICollectionViewDataSourceImpl.collectionViewCellForItemAtIndexPath(file: app/webpack:/@nativescript/template-blank-vue-ts/node_modules/@nativescript-community/ui-pager/index.ios.js:1048:0)

It seems that the 1st page is unloaded when moving to the 4th page, but it seems that an error has occurred due to this processing.
@nativescript-community/ui-pager/index.ios.js Commenting out line 635 eliminates the error.
However, if you just comment out line 635, a memory leak may occur.
Could you please provide a fix release for this issue?

  "dependencies": {
    "@nativescript-community/https": "^4.0.10",
    "@nativescript-community/ui-lottie": "^4.4.5",
    "@nativescript-community/ui-pager": "^13.0.43",
    "@nativescript-community/universal-links": "^3.0.0",
    "@nativescript/auto-fit-text": "^1.0.3",
    "@nativescript/core": "^8.3.6",
    "@nativescript/firebase-analytics": "^2.4.4",
    "@nativescript/firebase-core": "^2.4.4",
    "@nativescript/firebase-crashlytics": "^2.4.4",
    "@nativescript/iqkeyboardmanager": "^2.1.0",
    "@nativescript/secure-storage": "^3.0.0",
    "@nativescript/theme": "~3.0.2",
    "@nstudio/nativescript-loading-indicator": "^4.1.2",
    "@nstudio/nativescript-tracking-transparency": "^1.0.0",
    "@plmservices/nativescript-outline-label": "^2.0.2",
    "axios": "0.21.1",
    "compare-versions": "^4.1.3",
    "lodash": "^4.17.21",
    "maskdata": "^1.1.4",
    "nativescript-clipboard": "^2.1.1",
    "nativescript-dna-deviceinfo": "^3.7.3",
    "nativescript-vue": "~2.9.3",
    "nativescript-vue-router-ns": "^1.0.4",
    "url-parse": "^1.5.10",
    "vue-class-component": "^7.2.6",
    "vue-property-decorator": "^9.1.2",
    "vuelidate-property-decorators": "^1.0.28",
    "vuex": "^3.6.2",
    "vuex-class": "^0.3.2",
    "vuex-module-decorators": "^1.0.1"
  },
  "devDependencies": {
    "@babel/preset-env": "^7.14.2",
    "@nativescript/android": "~8.3.1",
    "@nativescript/eslint-plugin": "0.0.4",
    "@nativescript/ios": "~8.3.3",
    "@nativescript/types": "~8.3.1",
    "@nativescript/webpack": "5.0.11",
    "@types/jest": "^26.0.23",
    "@types/lodash": "^4.14.170",
    "@types/node": "~14.6.2",
    "@types/vuelidate": "^0.7.14",
    "@typescript-eslint/eslint-plugin": "^4.27.0",
    "@typescript-eslint/parser": "^4.27.0",
    "@vue/eslint-config-typescript": "^7.0.0",
    "@vue/test-utils": "^1.2.2",
    "axios-mock-adapter": "^1.19.0",
    "babel-core": "^7.0.0-bridge.0",
    "babel-jest": "^26.6.3",
    "cpx": "^1.5.0",
    "eslint": "^7.28.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^3.4.0",
    "eslint-plugin-vue": "^7.11.1",
    "flush-promises": "^1.0.2",
    "jest": "^26.6.3",
    "jest-html-reporter": "^3.4.0",
    "jest-sonar-reporter": "^2.0.0",
    "license-checker": "^25.0.1",
    "nativescript": "^8.3.3",
    "nativescript-vue-jest": "^3.0.4",
    "nativescript-vue-template-compiler": "~2.9.3",
    "npm-run-all": "^4.1.5",
    "prettier": "^2.8.0",
    "sonarqube-scanner": "^2.8.1",
    "ts-jest": "^26.5.6",
    "typescript": "~4.0.0",
    "vue": "^2.6.12",
    "vue-eslint-parser": "^7.6.0",
    "vue-jest": "^3.0.7",
    "vue-template-compiler": "^2.7.14"
  },

thank you for your answer.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with ui-pager configured for at least four pages on iOS, then inspect @nativescript-community/ui-pager/index.ios.js around line 635 and the _prepareCell stack trace. The fix is done when moving to the fourth page no longer throws removeFromSuperview on null and page cleanup does not introduce a memory leak.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, typescript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.