30 lines
773 B
TypeScript
30 lines
773 B
TypeScript
/**
|
|
* Wrapper component to easily apply theme-aware table styles
|
|
*/
|
|
|
|
import React, { useMemo } from "react";
|
|
import { View, ViewProps } from "react-native";
|
|
import { useAppTheme } from "@/hooks/use-app-theme";
|
|
import { createTableStyles } from "./style/createTableStyles";
|
|
|
|
interface ThemedTableProps extends ViewProps {
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export function ThemedTable({ style, children, ...props }: ThemedTableProps) {
|
|
const { colorScheme } = useAppTheme();
|
|
const tableStyles = useMemo(
|
|
() => createTableStyles(colorScheme),
|
|
[colorScheme]
|
|
);
|
|
|
|
return (
|
|
<View style={[tableStyles.container, style]} {...props}>
|
|
{children}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
export { createTableStyles };
|
|
export type { TableStyles } from "./style/createTableStyles";
|