react-native-collapsible-list
A ReactNative collapsible list component
Installation
You can install this package via yarn
:
yarn add react-native-collapsible-list
or npm
npm install react-native-collapsible-list --save
Basic Usage
;;; { return <View style=stylescontainer> <CollapsibleList numberOfVisibleItems=1 wrapperStyle=styleswrapperCollapsibleList buttonContent= <View style=stylesbutton> <Text style=stylesbuttonText>buttonText</Text> </View> > <View style=stylescollapsibleItem> <Text>Hello Collapsable List :</Text> </View> <View style=stylescollapsibleItem> <Text>Collapsable List Item</Text> </View> <View style=stylescollapsibleItem> <Text>Another Collapsable List Item</Text> </View> </CollapsibleList> </View> ); } const styles = StyleSheet;
Properties
Prop | Type | Default | Description |
---|---|---|---|
animationConfig | ReactNative.LayoutAnimationConfig | {duration: 700, update: { type: "spring", springDamping: 0.7, property: "scaleXY" }} |
Overrides each property of the default value if specified |
buttonContent | React.ReactNode |
null |
Content of collapse button |
buttonPosition | string (top or bottom ) |
bottom |
Position of collapse button |
numberOfVisibleItems | number |
1 |
Number of visible items when lis is not collapsed |
onToggle | function |
null |
Callback function for toggling the list with collapsed parameter which can be true (list is collapsed) or false (list is not collapsed) |
wrapperStyle | ReactNative.ViewStyle |
null |
The style of the list wrapper |
Contribution
You can fork the repository, improve or fix some part of it and then send the pull requests back if you want to see them here. I really appreciate that. 😉
License
Licensed under the MIT.