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

Android: app faulty on re-opens after minimising with hardware "back" (affects screen, keyboard, status bar, deep links) #28608

Closed
dancherb opened this issue Apr 13, 2020 · 7 comments
Labels
API: Keyboard Component: StatusBar Needs: Author Feedback Needs: Environment Info Please run `react-native info` and edit your issue with that command's output. Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@dancherb
Copy link

dancherb commented Apr 13, 2020

Sometimes when re-opening the app, the status bar becomes black and opaque at the top, and the keyboard behaviour with regards to content on-screen stops working. It is as if they've both been set to their defaults. This persists until the app is swiped closed and re-opened.

To reproduce (thanks to @alikazemkhanloo):

Open your app and close it with hardware back button, then open recent apps, and open your app from there

"react-native": "0.61.5" - observed on physical device, does not occur on emulator (may be dependent on Android version).

My AndroidManifest.xml setting is android:windowSoftInputMode="adjustResize"

I have tried both using methods and props on the StatusBar component to style it - none work to prevent this issue:

StatusBar.setBackgroundColor("rgba(0,0,0,0)")
StatusBar.setBarStyle("light-content")
StatusBar.setTranslucent(true)

<StatusBar barStyle="light-content" backgroundColor='rgba(0,0,0,0)' translucent/>

Similarly: on Android, deep links don't work when the app is already open in the background from pressing "back" out of the app. Minimising/closing the app by pressing home or force stopping is fine and deep links will work from this state.

@react-native-bot react-native-bot added API: Keyboard Component: StatusBar Platform: Android Android applications. Needs: Author Feedback Needs: Environment Info Please run `react-native info` and edit your issue with that command's output. and removed Needs: Triage 🔍 labels Apr 13, 2020
@github-actions
Copy link

⚠️ Missing Environment Information
ℹ️ Your issue may be missing information about your development environment. You can obtain the missing information by running react-native info in a console.

@dancherb
Copy link
Author

I've found a series of issues that describe this bug that were locked by a bot.

#23058

They helpfully give a way to reproduce the bug:

Open your app and close it with hardware back button, then open recent apps, and open your app from there

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Apr 13, 2020
@dancherb
Copy link
Author

Something else I've noted is: on Android deep links don't work when app is already open in the background from pressing "backing" out of the app (pressing home or force stopping is fine).

It seems like the state that the app is put into when you press the Android back button to minimise you is pretty buggy? Is there any documentation on how these states cometogehter?

@dancherb dancherb changed the title Android: screen, keyboard and statusbar sometimes reset to glitchy behaviour when re-opening app Android: app faulty on re-opens after minimising with hardware "back" (affects screen, keyboard, status bar, deep links) Apr 13, 2020
@Ashoat
Copy link
Contributor

Ashoat commented May 2, 2020

I'm not sure it'll help, but try adding this to your MainActivity.java:

  @Override
  public void invokeDefaultOnBackPressed() {
    moveTaskToBack(true);
  }

From Android docs for onBackPressed:

The default implementation simply finishes the current activity, but you can override this to do whatever you want.

Perhaps the activity "finishing" is what is causing some of these issues for you.

@chrisglein chrisglein added Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. and removed Needs: Attention Issues where the author has responded to feedback. labels May 13, 2020
@github-actions
Copy link

⚠️ Missing Required Fields
ℹ️ It looks like your issue may be missing some necessary information. GitHub provides an example template whenever a new issue is created. Could you go back and make sure to fill out the template? You may edit this issue, or close it and open a new one.

@stale
Copy link

stale bot commented Aug 16, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 16, 2020
@stale
Copy link

stale bot commented Aug 23, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Aug 23, 2020
@facebook facebook locked as resolved and limited conversation to collaborators Oct 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API: Keyboard Component: StatusBar Needs: Author Feedback Needs: Environment Info Please run `react-native info` and edit your issue with that command's output. Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

4 participants