import React, { memo } from 'react'
import { ActivityIndicator, StyleSheet, View } from 'react-native'
import { IObject } from 'interfaces'
import type { TableTheme } from './theme'

type LoadingIndicatorProps = {
  object: IObject
  theme: TableTheme
}

const LoadingIndicator = ({ object, theme }: LoadingIndicatorProps) => {
  return (
    <View style={{ height: object.attributes.height }}>
      <View style={styles.container}>
        <ActivityIndicator color={theme.cellText.color} />
      </View>
    </View>
  )
}

export default memo(LoadingIndicator)

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    padding: 16,
  },
  text: {
    textAlign: 'center',
  },
})
