Appearance API

React Native 5 min min read Updated: Jul 26, 2026 Intermediate
Appearance API
Intermediate Topic 26 of 30

Appearance API

The Appearance API allows React Native applications to detect the device’s current color scheme preference and respond to changes in real time, forming the foundation for dark mode support.

Getting the Current Color Scheme

javascript import { Appearance } from 'react-native'; const colorScheme = Appearance.getColorScheme(); console.log(colorScheme); // 'light' or 'dark'

Listening for Appearance Changes

The Appearance API provides an event listener that fires whenever the user changes their system theme setting while the app is running.

javascript useEffect(() => { const subscription = Appearance.addChangeListener(({ colorScheme }) => { console.log('Theme changed to', colorScheme); }); return () => subscription.remove(); }, []);

Appearance vs useColorScheme Hook

While the Appearance API can be used directly, the useColorScheme hook is generally preferred inside components since it automatically triggers a re-render when the theme changes, without manual event listener management.

javascript import { useColorScheme } from 'react-native'; const colorScheme = useColorScheme();

Building a Complete Theming Solution

Combining the Appearance API or useColorScheme hook with a Context Provider allows you to build a complete, app-wide theming solution that automatically adapts to system preferences.

Testing Appearance Changes

On both Android and iOS emulators, you can manually toggle system dark mode settings to test how your application responds to Appearance changes in real time.

Conclusion

The Appearance API is the foundation for building theme-aware React Native applications. Combined with the useColorScheme hook and Context, it enables a smooth, automatic dark mode experience for your users.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators