import React, { useCallback } from 'react'; import { StyleSheet, View } from 'react-native'; import type { StyleProp, ViewStyle } from 'react-native'; import MiniChart from './MiniChart'; import TextCell from './TextCell'; import ImageCell from './ImageCell'; import UrlCell from './UrlCell'; export type CellProps = { rowData: any; colData: any; style?: StyleProp; viewData?: boolean; }; const Cell: React.FC = ({ rowData, colData, style, viewData }) => { const getCell = useCallback(() => { if (colData.representation.type === 'miniChart' && !viewData) { return ( ); } if (colData.representation.type === 'image' && !viewData) { return ( ); } if (colData.representation.type === 'url') { return ; } return ; }, [colData, viewData, rowData]); return {getCell()}; }; const styles = StyleSheet.create({ textCol2: { fontWeight: 'bold', }, miniChart: { minHeight: 96, borderRadius: 4, borderWidth: 1, borderColor: '#CCCCCC', overflow: 'hidden', padding: 4, }, imageCell: { minHeight: 96, borderRadius: 4, padding: 4, borderWidth: 1, borderColor: '#CCCCCC', overflow: 'hidden', }, icon: { marginLeft: 8, }, }); export default Cell;