mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 12:06:42 +02:00
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>
43 lines
No EOL
1.3 KiB
TypeScript
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; |