codemotionapps/react-native-dark-mode

How can I change mode manually in app (like hook)

Closed this issue · 1 comments

Can I change to dark or light mode manually in App?

Yes: https://github.com/codemotionapps/react-native-dark-mode#darkmodeprovider

DarkModeProvider

Allows you to set a specific mode for children.

import { DarkModeProvider } from 'react-native-dark-mode'

function MyScreen() {
	return (
		<>
			{/* will be rendered using dark theme */}
			<DarkModeProvider mode="dark">
				<Component />
			</DarkModeProvider>

			{/* will be rendered using light theme */}
			<DarkModeProvider mode="light">
				<Component />
			</DarkModeProvider>

			{/* will be rendered using current theme */}
			<Component />
		</>
	)
}