import React, { memo } from 'react'
import { Text } from 'react-native'
import { isEqual } from 'lodash'

import { CellProps, FileValue } from './TableTypes'
import { styles } from './TableRow'

const FileCell = ({ cell, theme }: CellProps) => {
  const fileValue = cell.value as FileValue

  if (!fileValue) {
    return null
  }

  return (
    <Text
      ellipsizeMode="tail"
      numberOfLines={Number.MAX_SAFE_INTEGER}
      style={[styles.cellText, theme.cellText]}
    >
      {fileValue.filename}
    </Text>
  )
}

export default memo(FileCell, isEqual)
