/**
 * React Native Full App (https://store.enappd.com/product/react-native-full-app)
 *
 * Copyright © 2019-present Enappd. All rights reserved.
 *
 * This source code is licensed as per the terms found in the
 * LICENSE.md file in the root directory of this source tree.
 */
import React from 'react';
import { Item, Text, View, Icon } from 'native-base';

interface RatingComponentProps {
  ratingText: any;
  coloredDivParent: any;
  ratingIcon: any;
  ratingJson: any;
}

const RatingComponent = (props: RatingComponentProps) => {
  const { ratingText, coloredDivParent, ratingIcon, ratingJson } = props;
  return (
    <View>
      {ratingJson.map((rate: any, i: number) => {
        // styles.coloredDivParent = { ...styles.coloredDivParent, ...coloredDivParent }
        return (
          <Item key={i}>
            <Text style={ratingText}>
              {rate.stars}{' '}
              <Icon name="star" type="Ionicons" style={ratingIcon} />
            </Text>
            <View style={coloredDivParent}>
              <View
                style={{
                  backgroundColor: rate.viewBackground,
                  width: rate.viewWidth,
                  height: rate.viewHeight,
                }}
              />
            </View>
            <Text>{rate.view}</Text>
          </Item>
        );
      })}
    </View>
  );
};
export default RatingComponent;
