Closed azkahi closed 5 years ago
I think your updateSections
code is bit too complex. The onChange
callback already passed the updated activeSections array and you only have to set it in your state.
Thanks for your reply.
I also initially think that the onChange callback already passed the updated activeSections array. But when I tested it on my application, the passed parameter are:
0
, 1
, etc.) . Or,false
when the accordion is closed. Thus the implementation of my updateSections
. I'm confused as to why the passed parameter is not consistent.Is this a problem with my version of modules? I'm using "react-native-collapsible": "^0.12.0"
, "react-native": "0.55.3"
, "react": "16.3.1",
.
Is this a problem with my version of modules? I'm using "react-native-collapsible": "^0.12.0", "react-native": "0.55.3", "react": "16.3.1",.
This seems to be the cause. From what I found, the expandMultiple
prop is only supported since version 1.0.0 of react-native-collapsible
. Try installing a newer version and see if that solves it.
Thank you for your reply! 👍
I've changed the version to 1.0.0
and it now works; multiple sections can be opened.
Just as the title says. I have set expandMultiple={true} with the following:
Constructor;
updateSections function:
The idea on
updateSections
is to add the corresponding section index when it's not in theactiveSections
array and delete the element if the section index is in theactiveSections
array. When I try logging theidxSection
, it'll returnfalse
when a section is closing. Is it supposed to be that way? Or am I misunderstanding something?Anyway, the main goal that I want to achieve is to open several sections at once and not one section at a time. Setting the
expandMultiple
to true onAccordion
doesn't achieve that. And myupdateSections
function doesn't produce that, even though the arrayactiveSections
in the state has correctly represented opened sections (with the exclusion of the case when a section is closing as mentioned before).Any help would be appreaciated. Thanks in advance!