NativeScript / NativeScript/NativeScript

iOS 13: systemAppearanceChanged-event is called twice when user suspends app (without any darkmode change)

Open
#8,411 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css os: ios
Dominant language
TypeScript
Stars
25.7k
Forks
1.7k
Avg merge
1d 5h
Merged PRs (30d)
35

Description

Environment

  • CLI: 6.4.2
  • Cross-platform modules: @nativescript/core 6.4.2
  • Android Runtime: -
  • iOS Runtime: 6.4.2
  • Plugin(s): -

Describe the bug
When you suspend the NativeScript app on an iOS 13 device/simulator, the suspend-event will be triggered as expected, but then thesystemAppearanceChanged event will be triggered twice, one time with the opposite of the current dark-mode setting, and then with the current setting of darkmode.
That happens even if the user made no changes in the dark mode settings of the device.

This issue does not occur on Android devices and iOS 12. Only the suspend-Event gets triggered on those devices, as expected.

ios13_systemappearance_issue

To Reproduce
1.) Start the demo app provided below on a
2.) suspend the app and you will see some logs in the console:

suspendEvent
systemAppearanceChangedEvent: dark
systemAppearanceChangedEvent: light

If the dark mode is activated on the iOS 13 device bevore suspending the app, then the 2nd and the 3rd log come in reversed order.

Expected behavior
The systemAppearanceChanged event should not be triggered at all in this scenario (only the suspend-Event should be triggered).

Sample project
NSSystemAppearanceIssueIOS.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached NSSystemAppearanceIssueIOS.zip sample project and reproduce the suspend sequence on an iOS 13 device or simulator. Compare the suspend and systemAppearanceChanged logs with the expected behavior: suspending without a dark-mode change should trigger only the suspend event.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.