there is way to put icon "eye" from the "react-native-vector-icons directory - MaterialIcons" i need put the "eye" icon only in the 3 position of the accordion. this accordion come from the "native-base" lib.
this is the example that i want to achieve :
import React, { Component } from "react";
import { Container, Header, Content, Accordion } from "native-base";
const dataArray = [
{ title: "First Element", content: "Lorem ipsum dolor sit amet" },
{ title: "Second Element", content: "Lorem ipsum dolor sit amet" },
{ title: "Third Element", content: "Lorem ipsum dolor sit amet" }
];
export default class AccordionHeaderContentStyleExample extends Component {
render() {
return (
<Container>
<Header />
<Content padder>
<Accordion
dataArray={dataArray}
headerStyle={{ backgroundColor: "#b7daf8" }}
contentStyle={{ backgroundColor: "#ddecf8" }}
/>
</Content>
</Container>
);
}
}
Here is a working example.
https://snack.expo.io/9dGIGdAsg
import React, { Component } from "react";
import { Container, Header, Content, Icon, Accordion, Text, View } from "native-base";
const dataArray = [
{ title: "First Element", content: "Lorem ipsum dolor sit amet" },
{ title: "Second Element", content: "Lorem ipsum dolor sit amet" },
{ title: "Third Element", content: "Lorem ipsum dolor sit amet", icon: "visibilty" }
];
export default class AccordionCustomHeaderContent extends Component {
_renderHeader(item, expanded) {
return (
<View style={{
flexDirection: "row",
padding: 10,
justifyContent: "space-between",
alignItems: "center" ,
backgroundColor: "#A9DAD6" }}>
<Text style={{ fontWeight: "600" }}>
{" "}{item.title}
</Text>
{item.icon && (<Icon style={{ fontSize: 18 }} name="remove-circle" />)}
</View>
);
}
_renderContent(item) {
return (
<Text
style={{
backgroundColor: "#e3f1f1",
padding: 10,
fontStyle: "italic",
}}
>
{item.content}
</Text>
);
}
render() {
return (
<Container>
<Header />
<Content padder style={{ backgroundColor: "white" }}>
<Accordion
dataArray={dataArray}
animation={true}
expanded={true}
renderHeader={this._renderHeader}
renderContent={this._renderContent}
/>
</Content>
</Container>
);
}
}
<br/>