I need to know the colorScheme
of the device.
I've found two ways to know, but I don't understand what the difference is between the two.
Which one do you recommend to use and why?
import { Text, useColorScheme } from 'react-native';
const MyComponent = () => {
const colorScheme = useColorScheme();
return <Text>useColorScheme(): {colorScheme}</Text>;
};
import { Appearance } from 'react-native';
const colorScheme = Appearance.getColorScheme();
if (colorScheme === 'dark') {
// Use dark color scheme
}