Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
Describe the bug
Use plugin to show bottomsheet and closing modal we have this error:
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1 0x1055e160e NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2 0x105622548 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
3 0x106023222 ffi_closure_unix64_inner
4 0x106023c4a ffi_closure_unix64
5 0x7fff487b5be6 _UIGestureRecognizerSendTargetActions
6 0x7fff487b24b5 _UIGestureRecognizerSendActions
7 0x7fff487b1806 -[UIGestureRecognizer _updateGestureForActiveEvents]
8 0x7fff487a3329 _UIGestureEnvironmentUpdate
9 0x7fff487a2832 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:]
10 0x7fff487a25af -[UIGestureEnvironment _updateForEvent:window:]
11 0x7fff48c57a7f -[UIWindow sendEvent:]
12 0x7fff48c31ed9 -[UIApplication sendEvent:]
13 0x7fff48cbc336 __dispatchPreprocessedEventFromEventQueue
14 0x7fff48cbf502 __handleEventQueueInternal
15 0x7fff48cb606b __handleHIDEventFetcherDrain
16 0x7fff23da1c71 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
17 0x7fff23da1b9c __CFRunLoopDoSource0
18 0x7fff23da1374 __CFRunLoopDoSources0
19 0x7fff23d9bf6e __CFRunLoopRun
20 0x7fff23d9b884 CFRunLoopRunSpecific
21 0x7fff38b5ac1a GSEventRunModal
22 0x7fff48c19220 UIApplicationMain
23 0x106023a8d ffi_call_unix64
24 0x10d162410
JavaScript stack trace:
**_getTapData(file: node_modules/@nativescript/core/ui/gestures/gestures.ios.js:269:0)**
at file: node_modules/@nativescript/core/ui/gestures/gestures.ios.js:106:0
at file: node_modules/@nativescript/core/ui/gestures/gestures.ios.js:65:0
at UIApplicationMain([native code])
at run(file: node_modules/@nativescript/core/application/application.ios.js:312:0)
at file: node_modules/@nativescript/angular/platform-common.js:210:0
at file: node_modules/@nativescript/angular/platform-common.js:111:0
at file: node_modules/@nativescript/angular/platform-common.js:91:0
at file:///app/bundle.js:353:145
at ./main.ts(file:///app/bundle.js:358:34)
at __webpack_require__(file: src/webpack/bootstrap:750:0)
at checkDeferredModules(file: src/webpack/bootstrap:43:0)
at webpackJsonpCallback(file: src/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/core/ui/gestures/gestures.ios.js:269:0: JS ERROR TypeError: null is not an object (evaluating 'args.view.nativeViewProtected')**
***** Fatal JavaScript exception - application has been terminated. *****
To Reproduce
To reproduce crash use sample project linked below.
_If crash doesn't show up try a few times._
Expected behavior
Sample project
Here you can find a sample project to reproduce crash:
https://github.com/mapo80/ns-bug-gestures
Additional context
I've created a temporary fix using Webpack and changing source code of file "@nativescript/core/ui/gestures/gestures.ios.js".
This is the fix (but is only temporary):
if (platform === 'ios') {
config.module.rules.unshift({
test: /@nativescript\/core\/ui\/gestures\/gestures\.js$/,
use: [{
loader: 'string-replace-loader',
options: {
search: new RegExp("var center = recognizer\.locationInView\\(args\.view\.nativeViewProtected\\);", 'g'),
replace: 'if (args.view == null) { return; }\nvar center = recognizer.locationInView(args.view.nativeViewProtected);'
},
}],
});
}
I've replaced this:
var center = recognizer.locationInView(args.view.nativeViewProtected);
with this:
if (args.view == null) {
return;
}
var center = recognizer.locationInView(args.view.nativeViewProtected);
How to solve this crash definitely?
Thanks for the sample project 馃憤
Thanks for reporting this issue @mapo80 - published in 6.5.6 now 馃
Hi @NathanWalker, thanks very much for the fix but I can't use new version because of this issue:
https://github.com/NativeScript/NativeScript/issues/8631
I don't know how to solve.
Thanks
Most helpful comment
Thanks for reporting this issue @mapo80 - published in
6.5.6now 馃