Sticky Headers
Section headers that stick to the top of the screen while scrolling through their section.
Live Example
How It Works
Enable Sticky Headers
<SectionFlow
stickySectionHeadersEnabled={true}
// ...
/>
Style the Sticky Header
Apply additional styles when the header is stuck:
<SectionFlow
stickySectionHeadersEnabled={true}
stickyHeaderStyle={{
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5,
}}
/>
Dynamic Header Styling
Access the section in renderSectionHeader for dynamic styling:
renderSectionHeader={({ section }) => (
<View
style={[
styles.header,
{ borderLeftColor: getColorForSection(section.key) },
]}
>
<Text>{section.title}</Text>
</View>
)}
Best Practices
-
Solid Background - Always use a solid background color for sticky headers to prevent content showing through
-
Shadow for Depth - Add shadow/elevation to make it clear the header is floating
-
Compact Height - Keep sticky headers relatively short to maximize visible content
-
High Contrast - Ensure text is readable against the header background