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

import { formatLocation } from './utils'
import { CellProps } from './TableTypes'
import { styles } from './TableRow'

const LocationCell = ({ cell, theme }: CellProps): JSX.Element => {
  const formattedValue = formatLocation(cell)

  return <Text style={[styles.cellText, theme.cellText]}>{formattedValue}</Text>
}

export default memo(LocationCell, isEqual)
