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

Duplicate OnCreate on startup when theme is selected #103

Open
1 of 7 tasks
Inrego opened this issue Apr 12, 2020 · 1 comment
Open
1 of 7 tasks

Duplicate OnCreate on startup when theme is selected #103

Inrego opened this issue Apr 12, 2020 · 1 comment

Comments

@Inrego
Copy link

Inrego commented Apr 12, 2020

🐛 Bug Report

When a theme is selected, MainActivity.OnCreate is called twice upon startup. That results in 2x initialization, and end result is that the RootPage will show a back button, which when tapped, goes back to an empty tab page.

Expected behavior

Don't initialize app twice when a theme is selected.

Reproduction steps

  1. Select a different theme than "Auto"
  2. Close app (properly)
  3. Open app again.
    3.a. Back button should now be showing
  4. Tap back button
  5. Now you're stuck on an empty tab page, without being able to navigate further in the app. You have to close it and reopen.

Configuration

I only tested Android. Might be an issue on other platforms too.

Platform:

  • 📱 iOS
  • 🤖 Android
  • 🏁 WPF
  • 🌎 UWP
  • 🍎 MacOS
  • 📺 tvOS
  • 🐒 Xamarin.Forms
@Inrego
Copy link
Author

Inrego commented Apr 12, 2020

I do believe it's the Activity.Recreate() in ThemeService.
I tried commenting out the following lines, and the issue disappeared (it's not a fix, I know, but locates the problem).

if (Activity?.Theme != null && changed)
{
(Activity as MainActivity)?.Delegate.ApplyDayNight();
Activity.Recreate();
}

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

No branches or pull requests

1 participant