import React from 'react';
import type { RefreshControlProps as NativeRefreshControlProps } from 'react-native';
import { RefreshControl as NativeRefreshControl } from 'react-native';
import { useTheme } from '../../theme';

type RefreshControlProps = Omit<
  NativeRefreshControlProps,
  'colors' | 'tintColor'
>;

const RefreshControl = ({ ...props }: RefreshControlProps) => {
  const theme = useTheme();

  return (
    <NativeRefreshControl
      {...props}
      colors={[theme.__hd__.refreshControl.colors.indicator]}
      tintColor={theme.__hd__.refreshControl.colors.indicator}
    />
  );
};

export default RefreshControl;
