0

I'm new to react native and I have been working on a small project where I have use for accordion component after searching I found this
which I tried to implement the thing is how can I make this component reusable cause I have different data for different components. I want to do this without using a JSON file as data source. for example

getInitialState() {
   var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
return {
  dataSource: ds.cloneWithRows(_.range(25)),

here in datasource i want to pass data for different components

can anyone help

Srikar
  • 351
  • 5
  • 16
  • Does this answer your question? [Animated Accordion/ Drawer/ Drop-down/ Collapsible-card in React Native](https://stackoverflow.com/questions/67060475/animated-accordion-drawer-drop-down-collapsible-card-in-react-native) – Vipul Jul 25 '21 at 15:01

2 Answers2

2

The project that you are using was last updated 2 years ago. You may want to consider using this one instead: https://github.com/oblador/react-native-collapsible

Domingo Tamayo
  • 241
  • 2
  • 5
0

There's also another project named react-native-accordion-wrapper, and you can customize it in any way you'd like, and it's so easy to use:

<Accordion
    dataSource={[
       { title: 'header one', child: <Component1 /> },
       { title: 'header two', child: <Component2 /> },
    ]}
/>

you can also use another child component from this library named AccordionItem if you need more customization.

Aliunco
  • 399
  • 2
  • 9