Reputation: 371
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
Upvotes: 0
Views: 6743
Reputation: 399
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.
Upvotes: 0
Reputation: 261
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
Upvotes: 2