import React from "react";
import { View } from "react-native";

export default props => {

	let max = props.stats[0].doc_count;
	props.stats.forEach(item => {
		if (max < item.doc_count) {
			max = item.doc_count;
		}
	});

	const range = [];
	for (let i = props.range.start; i <= props.range.end; i += props.interval) {
		range.push(i);
	}

	return (
		<View style={{ flex: 1, flexDirection: "row", height: 50, alignItems: "flex-end", paddingHorizontal: props.paddingHorizontal }}>
			{
				range.map(item => {
					const value = props.stats.find(stat => stat.key === item) || 0;

					return (
						<View
							key={item}
							style={{
								backgroundColor: "#efefef",
								width: `${100 / range.length}%`,
								height: `${(100 * value.doc_count) / max || 0}%`
							}}
						></View>
					);
				})
			}
		</View>
	);
}

@@ -62,28 +62,83 @@
 %22;%0A%0A
-ex
+im
 port 
-default 
+types from %22../../utils/propTypesHelper%22;%0A%0Aconst Histogram = (
 props
+)
  =%3E 
@@ -886,8 +886,175 @@
 %3E%0A%09);%0A%7D%0A
+%0AHistogram.propTypes = %7B%0A%09stats: types.stats,%0A%09range: types.range,%0A%09interval: types.interval,%0A%09paddingHorizontal: types.paddingHorizontal%0A%7D%0A%0Aexport default Histogram;%0A

Add prop types check for Histogram #14