Skip to main content
Version: 1.x

Accordion List

The Accordion List component provides an accordion-style list with collapsible sections. The component also supports customization of labels, icons, styles, and themes. It uses animations from the react-native-reanimated library to animate the opening and closing of the accordion sections.

Import

import { AccordionList } from "@tra-tech/react-native-kitra";    

Usage

import { AccordionList } from "@tra-tech/react-native-kitra";    

const AccordionListData =[
{name:'React',value:1},
{name:'Native',value:2},
{name:'Kitra',value:3},
{name:'React Native Kitra',value:4}]

const App =()=>{
return(
<View style={{ backgroundColor: '#8973CD', padding: 10, borderRadius: 5 }}>
<AccordionList
displayedItem={x => x.name}
itemDisplay={x => x.name}
onSelect={x => console.log(x)}
label="Grey Daze"
left={() => <MaterialCommunityIcons name="flower-tulip" size={24} color="dimgrey" />}
data={AccordionListData}
/>
</View>
)
}

export default App;

Props

NameTypeRequiredDescription
dataArray<any> YesThe data to render in the accordion list.
labelstringNoThe label to display at the top of the accordion list.
left(expanded: boolean) => React.ReactNode NoAn optional function that returns a React element to display on the left side of the label.
right(expanded: boolean) => React.ReactNodeNoAn optional function that returns a React element to display on the right side of the label.
labelContainerStyleStyleProp<ViewStyle>NoAdditional styles to apply to the label container.
labelStyleStyleProp<TextStyle>NoAdditional styles to apply to the label text.
rowTextStyleStyleProp<TextStyle>NoAdditional styles to apply to the row text.
rowStyleStyleProp<ViewStyle>NoAdditional styles to apply to each row container.
onSelect(item: any) => void YesA callback function that will be called when a row is selected.
itemDisplay(item: any) => string | JSX.Element | null YesA function that returns a string or JSX element to display for each row.
themeUIThemeNoThe theme to use for the component.
typographyUITypographyNoThe typography to use for the component.