nativescript-community / ui-pager

Pager / Carousel component that allows the user to swipe left and right through pages of data.
https://nativescript-community.github.io/ui-pager/
Apache License 2.0
18 stars 10 forks source link

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

Open YoshihiroAikawa opened 1 year ago

YoshihiroAikawa commented 1 year ago

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.

wjchoi87 commented 1 month ago

I had the same problem when using inside a .

I wrapped the in a StackLayout or something instead of using it directly and it worked.