1
0

themed-view.tsx 648 B

123456789101112131415
  1. import { useThemeColor } from '@/hooks/use-theme-color';
  2. import { View, type ViewProps } from 'react-native';
  3. export type ThemedViewProps = ViewProps & {
  4. lightColor?: string;
  5. darkColor?: string;
  6. lightBgColor?: string;
  7. darkBgColor?: string;
  8. };
  9. export function ThemedView({ style, lightColor, darkColor, lightBgColor, darkBgColor, ...otherProps }: ThemedViewProps) {
  10. const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background');
  11. const borderColor = useThemeColor({ light: lightBgColor, dark: darkBgColor }, 'border');
  12. return <View style={[{ backgroundColor, borderColor }, style]} {...otherProps} />;
  13. }