Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] Application.RequestedThemeChanged raised twice on iOS when switching to home screen and back #12512

Closed
Eilon opened this issue Oct 16, 2020 · 2 comments · Fixed by #12895
Labels
a/darkmode in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛

Comments

@Eilon
Copy link
Contributor

Eilon commented Oct 16, 2020

Description

Steps to Reproduce

  1. Create a Xamarin.Forms app that listens to the Application.RequestedThemeChanged event and set a breakpoint on the event handler (or log it somewhere)
  2. Launch app on iOS Simulator
  3. App will launch, life is good
  4. Switch away from app back to the device home screen and then switch back to your app

Expected Behavior

No ThemeChanged event should fire at all (because it didn't change!).

Actual Behavior

The ThemeChanged event fires twice: once to the theme that it isn't and then once back to the actual current theme.

Basic Information

  • Version with issue: <PackageReference Include="Xamarin.Forms" Version="4.8.0.1451" />
  • Last known good version: Don't know
  • Affected Devices: iOS

Screenshots

Watch video here:
XamarinDoubleThemeChangeVideo.zip

Reproduction Link

Clone repo: https://github.com/Eilon/XamarinThemeChange

Workaround

No workaround needed per se because you ultimately get the right theme. But my app does extra work because of the double theme change.

@Eilon Eilon added t/bug 🐛 s/unverified New report that has yet to be verified labels Oct 16, 2020
@StephaneDelcroix
Copy link
Member

mmm, I recall we had to add some caching for iOS to prevent that double fire (TriggerThemeChangedActual), but it might be broken...

@StephaneDelcroix StephaneDelcroix added p/iOS 🍎 a/darkmode and removed s/unverified New report that has yet to be verified labels Oct 19, 2020
@Eilon
Copy link
Contributor Author

Eilon commented Oct 19, 2020

This was all on the iOS 14 Simulator.

@jsuarezruiz jsuarezruiz added the in-progress This issue has an associated pull request that may resolve it! label Nov 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/darkmode in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants