Is there anyway to programmatically expand the accordion?
I tried with set ref then setNativeProps({expanded: 0}) but failed instead.
@fuj1w4r4
Try this way to expand the element at 2nd index of Accordion dataArray:
< Accordion
expanded={2}
dataArray={dataArray}
/>
Closing this issue due to inactivity
Reopen this issue if help needed
Hi, also facing the same problem I would like to expand/ collapse the accordion when a certain event takes place..
I realize I'm a little late to the party, but I solved this issue today. Include a ref property in the Accordion, as follows:
<Accordion
ref={c => (this._accordion = c)}
dataArray={dataArray}
renderHeader={this._filterHeader}
renderContent={this._filterContent}
/>
Then, to programmatically expand a tab, you can do this:
this._accordion.setSelected(n); (where n is the index of the tab you would like to open)
To close all tabs, you can do this:
this._accordion.setSelected(-1);
This works with native-base v2.12.1.
@grahamyesfit
in my case this. _accordion is null
@grahamyesfit accordionRef.setSelected is not a function. Native base 2.13.8

current was missing. This works thanks!
accordionRef.current.setSelected(0);
Most helpful comment
I realize I'm a little late to the party, but I solved this issue today. Include a ref property in the Accordion, as follows:
Then, to programmatically expand a tab, you can do this:
this._accordion.setSelected(n);(wherenis the index of the tab you would like to open)To close all tabs, you can do this:
this._accordion.setSelected(-1);This works with native-base v2.12.1.