I am using react-native-collapsible in my application to achieve accordion view.
https://github.com/oblador/react-native-collapsible
It works fine but we got a change in requirement where we do not want the Accordion click functionality i.e the Accordion should not expand on click. I can do it by creating a separate div but I am thinking of a work around of reusing the same react-native-collapsible and achieve the same.
Code for Accordion-
const SECTIONS = [
{
title: 'First',
content: 'Lorem ipsum...',
},
{
title: 'Second',
content: 'Lorem ipsum...',
},
];
class AccordionView extends Component {
state = {
activeSections: [],
};
_renderContent = section => {
return (
<View style={styles.content}>
<Text>{section.content}</Text>
</View>
);
};
}
render() {
return (
<Accordion
sections={SECTIONS}
activeSections={this.state.activeSections}
renderSectionTitle={this._renderSectionTitle}
renderHeader={this._renderHeader}
renderContent={this._renderContent}
onChange={this._updateSections}
/>
);
}
}
So, to achieve that, I am trying to remove renderContent function completely from my Accordion but this gives me error -
TypeError: renderContent is not a function
Can someone let me know if there is a way I can hide the the Accordion content while reusing the same codebase. Any help is much appreciated.