Sharpnado.Tabs
Sharpnado.Tabs copied to clipboard
[MAUI] Bottom Tabs Not Interactable After Suspending Android App
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:
- Launch Sharpnado Tabs Maui Sample (fresh start)
- Click back button on device to suspend app
- 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.
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?
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.
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.
Fixed by reregistering the effect in the OnHandlerChanged override.
@Masgharoth How'd you go about doing that?