NativeScript / NativeScript/NativeScript

Modal page not working after suspend/resume

Open
#7,857 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog bug modal-page os: android
Dominant language
TypeScript
Stars
25.7k
Forks
1.7k
Avg merge
1d 5h
Merged PRs (30d)
35

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the tns-template-master-detail-ts app, Android Developer options set to “Don't keep activities,” and the modal open during suspend/resume. Start with car-detail-edit-page.ts at onCancelButtonTap and the stack-trace entry points in action-bar.js; done means modal options remain responsive after resume and Cancel no longer crashes with a navigation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, typescript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.