Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] - Crash on gestures - node_modules/@nativescript/core/ui/gestures/gestures.ios.js:269:0: JS ERROR TypeError: null is not an object (evaluating 'args.view.nativeViewProtected') #8641

Closed
mapo80 opened this issue Jun 16, 2020 · 3 comments · Fixed by #8645
Assignees

Comments

@mapo80
Copy link
Contributor

mapo80 commented Jun 16, 2020

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):

  • CLI:
    6.7.4
  • Cross-platform modules:
    6.5.5
  • Android Runtime:
    6.5.0
  • iOS Runtime:
    6.5.0
  • Plugin(s):
    nativescript-material-bottomsheet: 3.2.8

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.

  • Tap on "Open modal"
  • Close modal tapping on yellow button and simultaneously do a swipe down.

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?

@NathanWalker
Copy link
Contributor

Thanks for the sample project 👍

@NathanWalker
Copy link
Contributor

Thanks for reporting this issue @mapo80 - published in 6.5.6 now 🤗

@mapo80
Copy link
Contributor Author

mapo80 commented Jun 17, 2020

Hi @NathanWalker, thanks very much for the fix but I can't use new version because of this issue:
#8631

I don't know how to solve.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants