Multiple Expanded Sections are here!
One of the most requested features was added in this release - the ability to have open multiple sections in the Accordion. Be sure to check the example app to see it in action.
To facilitate this; two new props were added.
expandMultiple
- Allows expanding multiple sections
activeSections
- An array of active sections (index)
Props to @jdonald 🎉
⚠️ Breaking Changes ⚠️
All the changes below are for the Accordion
activeSection
is now deprecated.
Since we allow for multiple sections now, you'll need to use the new activeSections
prop instead which is an array of indices.
Before | After |
---|---|
<Accordion activeSection={0} />
| <Accordion activeSections={[0]} />
|
onChange
now returns an array of indices.
Previously onChange
would've returned the current index that was active. This change is related to multiple expanded sections.
Before | After |
---|---|
<Accordion onChange={section => // 0} />
| <Accordion onChange={sections => // [0]} />
|
initiallyActiveSection
is now deprecated.
Setting an initial section to be active is now as easy as using setting the activeSections
prop to the index you want.
Before | After |
---|---|
<Accordion initialActiveSection={2} />
| <Accordion activeSections={[2]} />
|
Misc
- Updated Example app to expo sdk v30