NativeScript / NativeScript/NativeScript

New Webview added to view stack when coming from background

Open
#4,981 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I've wrote a small app that has a webview to illustrate the issue: https://github.com/surdu/TestBkg

In the onload method of that webview I have implemented a quick mechanism to change the webview's src only the first time the onload method is called, just to illustrate better the problem.

To reproduce the problem we follow these steps:

  1. launch the app on Android using tns run android. We notice the app load NS' website.
  2. put the app in background by pressing the home button
  3. bring back the app by pressing the app icon on the phone

On the last step is where the problem is: a new blank webview is added on top of the old one (if we press the back button on the phone, the old webview will be revealed).

Now let's consider a second scenario. After completing the above scenario, we kill the app by pressing the Overview button and close our app from there (by swipe or by pressing the X button).

Now, if we replace the step 1 by just opening the app from the phone (NOT by running tns run android) and then go through the same steps, we'll notice that at step 3 the behaviour changes: now we will be correctly presented with the old webview.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

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

Start with the linked reproduction app at app/main-page.js and reproduce the lifecycle using tns run android, following the background and app-reopen steps. Trace the Android webview behavior when the app returns from the background; done means reopening the app does not add a blank webview above the existing one.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.