Skip to content

Blank screen after exiting app with android back button #2088

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

Closed
james-wynne-dev opened this issue Nov 25, 2019 · 1 comment
Closed

Blank screen after exiting app with android back button #2088

james-wynne-dev opened this issue Nov 25, 2019 · 1 comment

Comments

@james-wynne-dev
Copy link

james-wynne-dev commented Nov 25, 2019

Environment
‼ Update available for component nativescript. Your current version is 6.0.3 and the latest available version is 6.2.2.
‼ Update available for component tns-core-modules. Your current version is 6.0.7 and the latest available version is 6.2.1.
‼ Update available for component tns-android. Your current version is 6.0.2 and the latest available version is 6.2.0.
‼ Update available for component tns-ios. Your current version is 6.0.2 and the latest available version is 6.2.0.

Describe the bug
Using the Android back button, I go back through the page history until I get to the end of the stack, at which point the back button closes the app. When I resume the app the screen is sometimes blank. I have logged the application, Angular and Android events to see if I can see what is happening:

// Back button out of app
JS: Android Event: activityBackPressed, Activity: com.tns.NativeScriptActivity@4e5855
JS: Application Event: suspend
JS: Android Event: activityPaused, Activity: com.tns.NativeScriptActivity@4e5855
JS: Android Event: activityStopped, Activity: com.tns.NativeScriptActivity@4e5855
JS: Application Event: exit
JS: Destroy: home
JS: Destroy: app.component
JS: Android Event: activityDestroyed, Activity: com.tns.NativeScriptActivity@4e5855

// Relaunch the app
JS: Application Event: launch
JS: Init: app.component
JS: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
JS: Init: home
JS: Android Event: activityStarted, Activity: com.tns.NativeScriptActivity@7534bd4
JS: Android Event: activityResumed, Activity: com.tns.NativeScriptActivity@7534bd4
JS: Application Event: resume

As you can see from above, when using the back button out of the app, the home and app.components are destroyed and reinitialised on resumption. But, although the app and home components are created the screen is sometimes blank.

When using the Overview or Home Android buttons the events are different and there are no errors when resuming the app. In particular, notice that app.component home component are not destroyed and the saveActivityState event is triggered:

// Exit with Home or Overview button
JS: Application Event: suspend
JS: Android Event: activityPaused, Activity: com.tns.NativeScriptActivity@7534bd4
JS: Android Event: activityStopped, Activity: com.tns.NativeScriptActivity@7534bd4
JS: Android Event: saveActivityState, Activity: com.tns.NativeScriptActivity@7534bd4, Bundle: Bundle[{com.google.app_measurement.screen_service=Bundle[{referrer_name=NativeScriptActivity, id=8219038340691230053, name=null}], android:viewHierarchyState=Bundle[{android:views={7=com.telerik.android.primitives.widget.sidedrawer.SideDrawerState@3b95c27, 8=android.view.AbsSavedState$1@fec84d5, 9=HorizontalScrollView.SavedState{d2a4ed4 scrollPosition=0 isLayoutRtl=false}, 16908290=android.view.AbsSavedState$1@fec84d5, 2131296266=android.view.AbsSavedState$1@fec84d5, 2131296277=android.view.AbsSavedState$1@fec84d5}}], android:lastAutofillId=1073741823, android:fragments=android.app.FragmentManagerState@b00587d}]

// Resume
JS: Android Event: activityStarted, Activity: com.tns.NativeScriptActivity@7534bd4
JS: Android Event: activityResumed, Activity: com.tns.NativeScriptActivity@7534bd4
JS: Application Event: resume

@NickIliev
Copy link

Should be resolved via this PR - please do let me know if you are still experiencing the issue after using the latest nativescript-angular package.

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

No branches or pull requests

2 participants