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

[MAUI] Bottom Tabs Not Interactable After Suspending Android App #84

Closed
expensivecow opened this issue May 25, 2023 · 11 comments
Closed
Labels
bug Something isn't working

Comments

@expensivecow
Copy link

expensivecow commented May 25, 2023

Platform (please complete the following information):

  • OS: [Android]
  • Device: [Android Emulator(Pixel 5)]
  • Sdk Version: [Android SDK API 29]
  • MAUI: [7.0.86]

Describe the bug
Hi Roubachof! I am using bottom tabs similar to the provided sample in NET MAUI (https://github.com/roubachof/Sharpnado.Tabs/tree/main/MauiSample). When I suspend the app using the back button and relaunch it, the tabs are no longer interactable. To me, it looks like some states aren't being preserved on app suspension for some reason, but I have not been able to debug the issue further yet.

Would you have any insights on why this might occur? I'll try to take a look today/tomorrow to see what I can find out otherwise.

A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Launch Sharpnado Tabs Maui Sample (fresh start)
  2. Click back button on device to suspend app
  3. Re-Launch Sharpnado Tabs Sample

Observed Behavior: Bottom Tabs are not interactable.

Expected Behavior: Bottom Tabs can be clicked and views load as expected.

Screenshots (if applicable)
If applicable, add screenshots to help explain your problem.

@expensivecow
Copy link
Author

expensivecow commented May 25, 2023

I found a likely culprit. It seems to be a configuration issue -- if we set the ensure the already open activity is launched by setting LaunchMode to LaunchMode.SingleTop in MainActivity, it works as intended.

When the launch mode is not set, it seems that this case unregisters tap/touch effects when suspending the app (via pressing the back button). In this case, the effects may need to be re-registered (e.g., iterate through all selectable tabs and unset tab/touch effects, then reset them on page appearing).

Do you have any thoughts on the second case when LaunchMode is not set to LaunchMode.SingleTop?

@roubachof roubachof added the bug Something isn't working label May 31, 2024
@Masgharoth
Copy link

Masgharoth commented Jun 13, 2024

Same issue here. Are there any proper solutions to this or the LaunchMode is just that? It didnt solve our problem. Current workaround appears to be to remove and add a new instance of the tabs on each load.

@Masgharoth
Copy link

Btw: this is not strictly a sharpnado issue at its core. We have a custom control (extending ContentView) that utilizes toucheffects, and it also looses the effect after suspension. Fixed by reregistering the effect in the OnHandlerChanged override.
Therefore: this is probably a matter of Sharpnado.Tabs handling app suspension/restoration.

@svaldetero
Copy link

Fixed by reregistering the effect in the OnHandlerChanged override.

@Masgharoth How'd you go about doing that?

@janusw
Copy link
Collaborator

janusw commented Oct 8, 2024

@expensivecow @Masgharoth @svaldetero Did anyone manage to work around this issue? If yes, could you please share the exact workaround?

Would be good to finally get this fixed properly ...

@svaldetero
Copy link

svaldetero commented Oct 8, 2024

@svaldetero Did anyone manage to work around this issue? If yes, could you please share the exact workaround?

@janusw I did not. My app is running in Kiosk mode, so I just terminated the app when they try to suspend. Not a good approach, but better than the app being unusable after resuming.

Platform.CurrentActivity.FinishAffinity();
Environment.Exit(0);

@janusw
Copy link
Collaborator

janusw commented Oct 8, 2024

@svaldetero Did anyone manage to work around this issue? If yes, could you please share the exact workaround?

@janusw I did not. My app is running in Kiosk mode, so I just terminated the app when they try to suspend.

Thanks for the reply! Anyone else? @expensivecow @Masgharoth

Btw, I can reproduce the problem, as described in the original report (also with .NET 8 on the current main branch).

@janusw
Copy link
Collaborator

janusw commented Oct 8, 2024

I think I found a fix, see #126. Testing and feedback welcome ...

@roubachof
Copy link
Owner

Guys I'm currently testing it with the MauiSample and I can't reproduce the issue (MAUI 8/Pixel 5), so I guess it was a maui 7 issue
touch working.webm

@roubachof roubachof added the not reproducible Cannot replicate the issue label Oct 18, 2024
@roubachof
Copy link
Owner

Ok I reproduced it and will be fixed with version 3.1.0

@roubachof roubachof removed the not reproducible Cannot replicate the issue label Oct 18, 2024
@roubachof
Copy link
Owner

should be fixed by v3.1.0, please re-open if it doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants