react-native-collapsible-header

Inspiration. (also this Snack)
Installation
yarn add react-native-collapsible-header
Definition
type collapsible = backgroundColor?: string flatList?: boolean // default = false max?: number // default = 44 min?: number // default = 20 (ios), 24 (android) renderContent: any // <Component /> renderHeader: any // <Component /> // ScrollView props can be passed // FlatList props can be passed;
Example
;; ; const Header = <View style=stylesheader> <Text style=stylesheaderText>Header</Text> </View>; const Content = { const contentStyle = stylescontent backgroundColor: gray ? '#f7f7f7' : '#fff' ; return <View style=contentStyle> <Text style=stylescontentText>Content</Text> </View> ;}; const color = '#0f9d58'; { StatusBar; } { return <Collapsible backgroundColor=color renderHeader=<Header /> // renderContent is not needed if using FlatList renderContent= <View> <Content /> <Content gray /> <Content /> <Content gray /> <Content /> <Content gray /> <Content /> <Content gray /> <Content /> <Content gray /> </View> // flatList // data={Array(10).fill()} // keyExtractor={(item, i) => String(i)} // renderItem={({ index }) => <Content gray={index % 2 !== 0} />} /> ; } const styles = header: alignItems: 'center' flex: 1 justifyContent: 'center' headerText: color: '#fff' content: alignItems: 'center' justifyContent: 'center' contentText: color: '#444' padding: 40 ;