managarten/memoro/apps/mobile/components/atoms/ThemedStatusBar.tsx
Till-JS e7f5f942f3 chore: initial commit - consolidate 4 projects into monorepo
Projects included:
- maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing)
- manacore (Expo mobile + SvelteKit web + Astro landing)
- manadeck (NestJS backend + Expo mobile + SvelteKit web)
- memoro (Expo mobile + SvelteKit web + Astro landing)

This commit preserves the current state before monorepo restructuring.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:38:24 +01:00

43 lines
No EOL
1.3 KiB
TypeScript

import React, { useMemo } from 'react';
import { StatusBar } from 'expo-status-bar';
import { Platform } from 'react-native';
import { useTheme } from '~/features/theme/ThemeProvider';
import colors from '~/tailwind.config.js';
/**
* ThemedStatusBar component
*
* A global StatusBar component that automatically matches the header background color
* based on the current theme variant and dark mode setting.
*/
const ThemedStatusBar: React.FC = () => {
const { isDark, themeVariant } = useTheme();
// Get the header background color from theme config
const headerBackgroundColor = useMemo(() =>
isDark
? colors.theme.extend.colors.dark[themeVariant].menuBackground
: colors.theme.extend.colors[themeVariant].menuBackground,
[isDark, themeVariant]);
// Determine status bar style based on background color brightness
const statusBarStyle = useMemo(() => {
// For dark mode, use light content (white text/icons)
if (isDark) {
return 'light';
}
// For light mode, use dark content (dark text/icons)
return 'dark';
}, [isDark]);
return (
<StatusBar
style={statusBarStyle}
backgroundColor={Platform.OS === 'android' ? headerBackgroundColor : undefined}
translucent={Platform.OS === 'android'}
/>
);
};
export default ThemedStatusBar;