Skip to content

Commit

Permalink
Fix the dark mode release from iOS background (#162)
Browse files Browse the repository at this point in the history
* Fix the dark mode release from iOS background

* Change to Appearance.getColorScheme() call only on iOS
  • Loading branch information
Jay-flow committed Nov 4, 2021
1 parent 50af641 commit ae33f0f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/theme/useColorScheme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Appearance, ColorSchemeName} from 'react-native';
import {Appearance, ColorSchemeName, Platform} from 'react-native';
import {useEffect, useState} from 'react';

export const useColorScheme = (): ColorSchemeName => {
Expand All @@ -7,7 +7,10 @@ export const useColorScheme = (): ColorSchemeName => {

useEffect(() => {
const listener = ({colorScheme}): void => {
setColorType(colorScheme);
const platformColorScheme =
Platform.OS === 'ios' ? Appearance.getColorScheme() : colorScheme;

setColorType(platformColorScheme);
};

Appearance.addChangeListener(listener);
Expand Down

0 comments on commit ae33f0f

Please sign in to comment.