import * as React from 'react';
import { View, Text, ViewStyle, Pressable, TextStyle } from 'react-native';
import Node from '../node';
import Icon from '../icon';
import styles from './style';
import Theme from '../style/theme';
const prefixCls = 'cell';
export interface CellProps {
label?: React.ReactNode;
children?: React.ReactNode;
labelDescription?: React.ReactNode;
style?: ViewStyle;
labelStyle?: ViewStyle;
valueStyle?: ViewStyle;
labelDescriptionStyle?: ViewStyle | TextStyle;
vertical?: boolean;
icon?: string;
iconSize?: number;
required?: boolean;
arrow?: boolean;
extra?: React.ReactNode;
defaultNullValue?: string;
textAlign?: 'left' | 'right' | 'center';
onPress?: () => void;
}
const Cell = (props: CellProps) => {
const {
label,
style,
labelStyle,
valueStyle,
labelDescription,
labelDescriptionStyle,
children,
vertical,
icon,
iconSize,
arrow,
extra,
required,
defaultNullValue = '',
textAlign = 'right',
onPress,
} = props;
if (vertical) {
return (
{label ? (
{required ? * : null}
{label ? (
{label}
{labelDescription}
) : null}
) : null}
{children}
);
}
return (
{required ? * : null}
{icon ? (
) : null}
{label ? (
{label}
{labelDescription}
) : null}
{children || children === 0 ? children : defaultNullValue}
{extra ? {extra} : null}
{arrow ? (
) : null}
);
};
export default Cell;