codemotionapps/react-native-dark-mode

A lightweight "detection only" variant

Closed this issue · 1 comments

This is a great wrapper to support dark mode without any infrastructure. But if you already have and use theming options, this library does a little bit too much.

Is it possible to extract useDarkMode and useDarkModeContext as the most lightweight variant of this repo? Maybe as react-native-dark-mode-detection or something else? This would be great and super useful.

Unfortunately, I lack the knowledge to do it myself.

That would be unnecessary. Here's the most lightweight version:

import { useDarkMode } from 'react-native-dark-mode/dist/use-dark-mode'

Also, this "most lightweight version" is exactly what the React Native team is doing. You can read more here: react-native-community/discussions-and-proposals#126
And the iOS version is already in master: facebook/react-native@63fa3f2