Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3397219
D5605.id18352.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D5605.id18352.diff
View Options
diff --git a/native/ios/Podfile.lock b/native/ios/Podfile.lock
--- a/native/ios/Podfile.lock
+++ b/native/ios/Podfile.lock
@@ -841,8 +841,6 @@
- React-perflogger (= 0.66.5)
- ReactNativeART (1.2.0):
- React
- - ReactNativeDarkMode (0.2.0-rc.1):
- - React
- ReactNativeKeyboardInput (6.0.1):
- React
- ReactNativeKeyboardTrackingView (5.7.0):
@@ -1010,7 +1008,6 @@
- React-runtimeexecutor (from `../../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`)
- "ReactNativeART (from `../../node_modules/@react-native-community/art`)"
- - ReactNativeDarkMode (from `../../node_modules/react-native-dark-mode`)
- ReactNativeKeyboardInput (from `../../node_modules/react-native-keyboard-input`)
- ReactNativeKeyboardTrackingView (from `../../node_modules/react-native-keyboard-tracking-view`)
- "RNCAsyncStorage (from `../../node_modules/@react-native-async-storage/async-storage`)"
@@ -1178,8 +1175,6 @@
:path: "../../node_modules/react-native/ReactCommon"
ReactNativeART:
:path: "../../node_modules/@react-native-community/art"
- ReactNativeDarkMode:
- :path: "../../node_modules/react-native-dark-mode"
ReactNativeKeyboardInput:
:path: "../../node_modules/react-native-keyboard-input"
ReactNativeKeyboardTrackingView:
@@ -1296,7 +1291,6 @@
React-runtimeexecutor: 09041c28ce04143a113eac2d357a6b06bd64b607
ReactCommon: 8a7a138ae43c04bb8dd760935589f326ca810484
ReactNativeART: 78edc68dd4a1e675338cd0cd113319cf3a65f2ab
- ReactNativeDarkMode: 88317ff05ba95fd063dd347ad32f8c4cefd3166c
ReactNativeKeyboardInput: 266ba27a2e9921f5bdc0b4cc30289b2a2f46b157
ReactNativeKeyboardTrackingView: 02137fac3b2ebd330d74fa54ead48b14750a2306
RNCAsyncStorage: 0c357f3156fcb16c8589ede67cc036330b6698ca
diff --git a/native/package.json b/native/package.json
--- a/native/package.json
+++ b/native/package.json
@@ -85,7 +85,6 @@
"react-native": "0.66.5",
"react-native-background-upload": "^6.5.1",
"react-native-camera": "^3.31.0",
- "react-native-dark-mode": "^0.2.0-rc.1",
"react-native-device-info": "^8.0.7",
"react-native-exit-app": "^1.1.0",
"react-native-fast-image": "^8.3.0",
diff --git a/native/themes/theme-handler.react.js b/native/themes/theme-handler.react.js
--- a/native/themes/theme-handler.react.js
+++ b/native/themes/theme-handler.react.js
@@ -1,10 +1,8 @@
// @flow
+import invariant from 'invariant';
import * as React from 'react';
-import {
- initialMode as initialSystemTheme,
- eventEmitter as systemThemeEventEmitter,
-} from 'react-native-dark-mode';
+import { Appearance } from 'react-native';
import { useDispatch } from 'react-redux';
import type { Shape } from 'lib/types/core';
@@ -21,7 +19,7 @@
const globalThemeInfo = useSelector(state => state.globalThemeInfo);
const dispatch = useDispatch();
const updateSystemTheme = React.useCallback(
- (colorScheme: GlobalTheme) => {
+ (colorScheme: ?GlobalTheme) => {
if (globalThemeInfo.systemTheme === colorScheme) {
return;
}
@@ -45,20 +43,21 @@
if (!osCanTheme) {
return undefined;
}
- systemThemeEventEmitter.addListener(
- 'currentModeChanged',
- updateSystemTheme,
- );
- return () => {
- systemThemeEventEmitter.removeListener(
- 'currentModeChanged',
- updateSystemTheme,
+ const subscription = Appearance.addChangeListener(({ colorScheme }) => {
+ invariant(
+ colorScheme === undefined ||
+ colorScheme === null ||
+ colorScheme === 'light' ||
+ colorScheme === 'dark',
+ 'Flow types for Appearance module are non-specific',
);
- };
+ updateSystemTheme(colorScheme);
+ });
+ return () => subscription.remove();
}, [updateSystemTheme]);
React.useEffect(
- () => updateSystemTheme(initialSystemTheme),
+ () => updateSystemTheme(Appearance.getColorScheme()),
// eslint-disable-next-line react-hooks/exhaustive-deps
[],
);
diff --git a/yarn.lock b/yarn.lock
--- a/yarn.lock
+++ b/yarn.lock
@@ -4126,14 +4126,6 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc"
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==
-"@types/react-native@*":
- version "0.60.21"
- resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.60.21.tgz#81a41cae7b232f52ab3983d854f4a0b0df79531e"
- integrity sha512-E7F+P/UG4Utu+kh8Hy544i0m4CzpHw1awNX6hVfkhlu4mXSlAn6KLZzKEkPBbHm7g1kspmZTiuP23HAKZpASPw==
- dependencies:
- "@types/prop-types" "*"
- "@types/react" "*"
-
"@types/react-redux@^7.1.20":
version "7.1.21"
resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.21.tgz#f32bbaf7cbc4b93f51e10d340aa54035c084b186"
@@ -16315,17 +16307,6 @@
jscodeshift "^0.13.1"
nullthrows "^1.1.1"
-react-native-dark-mode@^0.2.0-rc.1:
- version "0.2.0-rc.1"
- resolved "https://registry.yarnpkg.com/react-native-dark-mode/-/react-native-dark-mode-0.2.0-rc.1.tgz#fc83f4a6d897613f49b49bde10f9c3d0f8e4ae69"
- integrity sha512-pxdr+vdL9KF0pRqlls9A31ie3DdlJ3/2soMTBAWGmqASEhYkvdduH2QvJStrjby0EDSxzV4lTLuw7FdIrkoldw==
- dependencies:
- "@types/events" "*"
- "@types/react" "*"
- "@types/react-native" "*"
- events "^3.0.0"
- toolkit.ts "^0.0.2"
-
react-native-device-info@^8.0.7:
version "8.0.7"
resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-8.0.7.tgz#c04f5dd50a977da21305b99088c0b42b588d07f9"
@@ -19073,11 +19054,6 @@
dependencies:
lodash "^3.2.0"
-toolkit.ts@^0.0.2:
- version "0.0.2"
- resolved "https://registry.yarnpkg.com/toolkit.ts/-/toolkit.ts-0.0.2.tgz#91bde730e5e6ad1a22146cdaf83f4a52721cf3b2"
- integrity sha512-yJJTVbCwiD6AfFgReewJCGJuODmyZUeL1sDjnxp33t0UBxnezgQrLbz/F9++RC28CTlk5u5pVji4TbeondYEkw==
-
touch@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 2, 4:39 PM (21 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2607717
Default Alt Text
D5605.id18352.diff (6 KB)
Attached To
Mode
D5605: [native] Deprecate react-native-dark-mode
Attached
Detach File
Event Timeline
Log In to Comment