I have this Barchart rendering component here
const BarCharts = () => {
const fill = 'rgb(134, 65, 244)'
const data = [50, 10, 40, 95, -4, -24, null, 85, undefined, 0, 35, 53, -53, 24, 50, -20, -80]
return (
<View style={styles.sectionContainer}>
<BarChart style={{ height: 200 }} data={data} svg={{ fill }} contentInset={{ top: 30, bottom: 30 }}>
<Grid />
</BarChart>
</View>
);
};
I have to use this component to draw up the barchart inside another component. I want to use the Barcharts component inside the if in the below component:
<SearchableDropdown
onItemSelect={(item) => {
if (item.type =='1') {
//alert(item.type);
return <BarCharts />
}
if (item.type =='2') {
alert(item.type);
}
}}
Currently the 'return' inside the conditional if is not returning anything. Upon clicking item1, BarCharts is to be returned