Open
Description
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.1.2
- Cross-platform modules: latest (6.1.1)
- Android Runtime: latest (6.1.1)
Describe the bug
Modal page not working and causing the app to crash after suspend/resume. Reproducible on NativeScript Core and NativeScript Angular.
To Reproduce
- From "Developer options" activate "Don't keep activities"
- Create a template app as shown in Sample Project below
- Select a car, open the template and tap on Edit
- Open the modal page e.g., by tapping "CLASS" - do not select an option / close the modal
- Suspend the app via the system buttons
- Resume the app and interact with the opened modal / navigation
Result:
- The modal options are no longer responsive - you can't select an option or use the Cancel button.
- Tapping outside the button will close the modal but the tapping on "Cancel" from the ActionBar will cause the app to crash with a navigation error (shown below)
Sample project
tns create my-master-detail-ts --template tns-template-master-detail-ts
cd my-master-details-ts
tns run android
Additional context
Outputed error:
System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method onClick failed
System.err: TypeError: Cannot read property 'goBack' of undefined
System.err: StackTrace:
System.err: onCancelButtonTap(file:///app\cars\car-detail-edit-page\car-detail-edit-page.ts:20:14)
System.err: at push.../node_modules/tns-core-modules/data/observable/observable.js.Observable.notify(file:///node_modules\tns-core-modules\data\observable\observable.js:110:0)
System.err: at push.../node_modules/tns-core-modules/data/observable/observable.js.Observable._emit(file:///node_modules\tns-core-modules\data\observable\observable.js:127:0)
System.err: at push.../node_modules/tns-core-modules/ui/action-bar/action-bar-common.js.ActionItemBase._raiseTap(file:///node_modules\tns-core-modules\ui\action-bar\action-bar-common.js:259:0)
System.err: at onClick(file:///node_modules\tns-core-modules\ui\action-bar\action-bar.js:304:0)
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1209)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1096)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1083)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1063)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1055)
System.err: at com.tns.gen.android.view.View_OnClickListener.onClick(View_OnClickListener.java:18)
System.err: at android.view.View.performClick(View.java:5265)
System.err: at android.view.View$PerformClick.run(View.java:21534)
System.err: at android.os.Handler.handleCallback(Handler.java:815)
System.err: at android.os.Handler.dispatchMessage(Handler.java:104)
System.err: at android.os.Looper.loop(Looper.java:207)
System.err: at android.app.ActivityThread.main(ActivityThread.java:5728)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
ActivityManager: Process org.nativescript.mymasterdetailts (pid 5454) has died
ActivityManager: SVC-handleAppDiedLocked: app = ProcessRecord{a57bbda 5454:org.nativescript.mymasterdetailts/u0a161}, app.pid = 5454
ActivityManager: cleanUpApplicationRecord -- 5454