2026-07-02 14:34:19 +05:30

31 lines
721 B
TypeScript

import React from 'react';
import { View, ViewStyle, TouchableOpacity } from 'react-native';
import { useAppTheme } from '@theme';
import { getStyles } from './card.styles';
interface CardProps {
children: React.ReactNode;
style?: ViewStyle;
onPress?: () => void;
}
export const Card: React.FC<CardProps> = ({ children, style, onPress }) => {
const { colors } = useAppTheme();
const styles = getStyles(colors);
if (onPress) {
return (
<TouchableOpacity
style={[styles.card, style]}
activeOpacity={0.8}
onPress={onPress}
>
{children}
</TouchableOpacity>
);
}
return <View style={[styles.card, style]}>{children}</View>;
};
export default Card;