import {StyleSheet, View} from 'react-native';
import React from 'react';

interface ListProps {
  data: any;
  renderItem: Function;
}

const CustomList: React.FC<ListProps> = ({ data, renderItem }) => {
  const renderList = () => {
    let list: any[] = [];

    for (let i = 0; i < data.length; i++) {
      const item = data[i];

      list[i] = renderItem(item, i);
    }

    return list;
  };

  return (
    <View>
      {renderList()}
    </View>
  );
};

export default CustomList;