triniwiz / nativescript-pager

Apache License 2.0
90 stars 48 forks source link

Crash on older ios devices when adding/removing items dynamically #157

Closed kryptus36 closed 4 years ago

kryptus36 commented 4 years ago

Which platform(s) does your issue occur on?

Works properly in the emulator (tried iPhone 8, 10). Works on physical iPhone 10 & all Androids I tested.

Please, provide the following version numbers that your issue occurs with:

"dependencies": { "@nstudio/nativescript-checkbox": "^1.0.0", "@proplugins/nativescript-purchase": "^2.1.1", "@types/node": "^12.12.7", "nativescript-iqkeyboardmanager": "^1.5.1", "nativescript-pager": "^11.0.11", "nativescript-plugin-firebase": "^10.1.1", "nativescript-secure-storage": "^2.6.0", "nativescript-theme-core": "^2.0.24", "nativescript-ui-listview": "^7.1.0", "nativescript-ui-sidedrawer": "^7.0.4", "tns-android": "^6.2.0", "tns-core-modules": "^6.3.1" }, "devDependencies": { "nativescript": "^6.3.0", "nativescript-dev-webpack": "^1.1.0-next-2019-07-16-145616-02", "typescript": "3.4.5" },

Please, tell us how to recreate the issue in as much detail as possible.

This looks to be a well-known issue in older ios versions.

Describe the steps to reproduce it.

This seems to trigger if: You use pop() on the observableArray You use push() on the observableArray multiple times or in a loop

See comments in my code examples (and workarounds in case its useful)

* Assertion failure in -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore/UIKit-3698.140/UICollectionView.m:6165 *** Fatal JavaScript exception - application has been terminated. ** Native stack trace: 1 0x101425d50 NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState, JSC::Exception, bool) 2 0x10143c3b4 NativeScript::FFICallback::ffiClosureCallback(ffi_cif, void*, void, void) 3 0x101fca9b8 ffi_closure_SYSV_inner 4 0x101fcc1b4 .Ldo_closure 5 0x1efc64a38 6 0x1efc657d4 7 0x1efc13008 8 0x1f01b8b20 9 0x1f01b3a58 10 0x1f01b2fb4 CFRunLoopRunSpecific 11 0x1f23b479c GSEventRunModal 12 0x21ca15c38 UIApplicationMain 13 0x101fcc044 ffi_call_SYSV 14 0x101fca0dc ffi_call_int 15 0x101fc9bd8 ffi_call 16 0x1013e8fe4 NativeScript::FunctionWrapper::call(JSC::ExecState) 17 0x101f96eb0 llint_entry 18 0x101f942c8 llint_entry 19 0x101f942c8 llint_entry 20 0x101f942c8 llint_entry 21 0x101f942c8 llint_entry 22 0x101f942c8 llint_entry 23 0x101f94220 llint_entry 24 0x101f942c8 llint_entry 25 0x101f75988 vmEntryToJavaScript 26 0x101521c6c JSC::Interpreter::executeCall(JSC::ExecState, JSC::JSObject, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) 27 0x101dc6e98 JSC::call(JSC::ExecState, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtr&) 28 0x101401550 NativeScript::GlobalObject::moduleLoaderEvaluate(JSC::JSGlobalObject, JSC::ExecState, JSC::JSModuleLoader, JSC::JSValue, JSC::JSValue, JSC::JSValue) 29 0x101c947e0 JSC::JSModuleLoader::evaluate(JSC::ExecState*, JSC::JSValue, JSC::JSValue, JSC::JSValue) 30 0x101f96b6c llint_entry 31 0x101f942c8 llint_entry JavaScript stack trace: performBatchUpdatesCompletion(file:///node_modules/nativescript-pager/pager.js:49:0) at file:///node_modules/nativescript-pager/pager.js:49:0 at UIApplicationMain([native code]) at run(file:///node_modules/@nativescript/core/application/application.js:312:0) at file:///app/bundle.js:159:16 at ./app.ts(file:///app/bundle.js:169:34) at webpack_require(file:///app/webpack/bootstrap:74:0) at checkDeferredModules(file:///app/webpack/bootstrap:43:0) at webpackJsonpCallback(file:///app/webpack/bootstrap:30:0) at anonymous(file:///app/bundle.js:2:61) at evaluate([native code]) at moduleEvaluation([native code]) at [native code] at asyncFunctionResume([native code]) at [native code] at promiseReactionJob([native code]) JavaScript error: file:///node_modules/nativescript-pager/pager.js:49:0: JS ERROR Error: Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (3) must be equal to the number of items contained in that section before the update (0), plus or minus the number of items inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out). *** JavaScript call stack: ( 0 UIApplicationMain@[native code] 1 run@file:///node_modules/@nativescript/core/application/application.js:312:0 2 @file:///app/bundle.js:159:16 3 ./app.ts@file:///app/bundle.js:169:34 4 webpack_require@file:///app/webpack/bootstrap:74:0 5 checkDeferredModules@file:///app/webpack/bootstrap:43:0 6 webpackJsonpCallback@file:///app/webpack/bootstrap:30:0 7 anonymous@file:///app/bundle.js:2:61 8 evaluate@[native code] 9 moduleEvaluation@:1:11 10 @:2:1 11 asyncFunctionResume@:1:11 12 @:24:9 13 promiseReactionJob@:1:11 )

*** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Error: Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (3) must be equal to the number of items contained in that section before the update (0), plus or minus the number of items inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out). at performBatchUpdatesCompletion(file:///node_modules/nativescript-pager/pager.js:49:0) at file:///node_modules/nativescript-pager/pager.js:49:0 at UIApplicationMain([native code]) at run(file:///node_modules/@nativescript/core/application/application.js:312:0) at file:///app/bundle.js:159:16 at ./app.ts(file:///app/bundle.js:169:34) at __webpack_require__(file:///app/webpack/bootstrap:74:0) at checkDeferredModules(file:///app/webpack/bootstrap:43:0) at webpackJsonpCallback(file:///app/webpack/bootstrap:30:0) at anonymous(file:///app/bundle.js:2:61) at evaluate([native code]) at moduleEvaluation([native code])\M-b\M^@\M-&

Is there any code involved?

Examples: https://github.com/kryptus36/pager-crash

I can also reproduce it in the ts demo project, though im not sure exactly why these specific steps trigger the behaviour.

-launch the app -tap on api demo -tap back to return to the main page -swipe several times until you get to slide 9