oblador / react-native-collapsible

Animated collapsible component for React Native, good for accordions, toggles etc
MIT License
2.44k stars 452 forks source link

Accordion: Last section item won't close #232

Closed C0dekid closed 6 years ago

C0dekid commented 6 years ago

When using the react-native-collapsible, I have noticed a strange behaviour in Accordion according to the sections. Opening from sections works fine. Closing works fine too, excepts for the last item. If I open the last item in the section list, it won't close anymore. I have to refresh the activity to make this section close again.

When I use the expandFromBottom={true} the items expands from bottom. Closing the items works for all.

<Accordion
initiallyActiveSection={0}
underlayColor={Colors.white.w2}
sections={[
    { folder_title: "Folder 1", folder_createddate: "28-08-2018 09:00" },
    { folder_title: "Folder 2", folder_createddate: "28-08-2018 09:00" },
    { folder_title: "Folder 3", folder_createddate: "28-08-2018 09:00" }
    ... etc.
]}
renderHeader={(item, index) => {
    return (
        <View key={index} style={folderSection}>
            <Icon type={'feather'} name={"folder"} iconStyle={{ marginRight: 5 }} size={20} />
            <Text style={sectionTitle}>{ item.folder_title }</Text>
        </View>
    );
}}
renderContent={(item, index) => {
    return (
        <View key={index} style={folderSection}>
            <Icon type={'feather'} name={"lock"} color={Colors.white.w5} iconStyle={{ marginRight: 5 }} size={25} />
            <View style={col}>
                <Text style={itemTitle}>{ item.folder_title }</Text>
                <Text style={[itemTitle, { fontWeight: "normal", color: Colors.white.w5 }]}>{ item.folder_createddate }</Text>
            </View>
        </View>
    );
}}
/>

Environment

OS: Windows 10 Node: 9.8.0 Yarn: Not Found npm: 5.7.1 Watchman: Not Found Xcode: N/A Android Studio: Not Found

Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: 0.55.4 => 0.55.4