expo-router-redux-template
Version:
An expo template featuring expo-router, reduxjs-toolkit, react-native-reanimated, and redux-persist for cross-platform mobile app development.
14 lines (11 loc) • 475 B
text/typescript
import Colors from '@/constants/Colors';
import useColorScheme from './useColorScheme';
// Define a custom hook for accessing theme colors
export default function useThemeColor(
colorName: keyof typeof Colors.light & keyof typeof Colors.dark
) {
// Retrieve the current color scheme from the app
const theme = useColorScheme();
// Return the corresponding color based on the provided color name and current color scheme
return Colors[theme][colorName];
}