Accordion-Collapse-react-native icon indicating copy to clipboard operation
Accordion-Collapse-react-native copied to clipboard

Any option or prop to default collapsed list

Open hpvaghani opened this issue 3 years ago • 3 comments

Hi,

Is there any option or prop that can be used to default list to be collapsed on load ?

hpvaghani avatar Dec 22 '20 12:12 hpvaghani

Could you share an example of the use case you want to achieve and which component are you using?

marouanekadiri avatar Dec 25 '20 21:12 marouanekadiri

Hi,

<AccordionList list={this.state.list} header={this._head} body={this._body} keyExtractor={item => ${item.id}} />

I was using the above snippet in my application, where there was header(of the items in list) and body(contains detail about item). It is working fine but there was an issue where all of the items in the list were unCollapsed. User has to collapse the items manually which behavior wise was bit odd. So i was looking for prop that after setting it all the bodies of the items would be default invisible and will be visible only after clicking header(default behavior). Also i was looking for a way to override header click(a button in header to call function other than toggling body).

hpvaghani avatar Dec 26 '20 04:12 hpvaghani

The body is by default hidden, no prop needed. If you put a button in the header and map it to a certain behavior the Accordion should not interfere with this scenario.

marouanekadiri avatar Dec 26 '20 10:12 marouanekadiri