File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
packages/core/src/components/SectionList Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -15,15 +15,17 @@ const SectionHeader: React.FC<React.PropsWithChildren<SectionHeaderProps>> = ({
1515interface DefaultSectionHeaderProps {
1616 title : string ;
1717 theme : ReadTheme ;
18+ backgroundColor ?: string ;
19+ textColor ?: string ;
1820}
1921export const DefaultSectionHeader = withTheme (
20- ( { title, theme } : DefaultSectionHeaderProps ) => {
22+ ( { title, theme, backgroundColor , textColor } : DefaultSectionHeaderProps ) => {
2123 return (
2224 < Text
2325 testID = "default-section-header"
2426 style = { {
25- color : theme . colors . background . base ,
26- backgroundColor : theme . colors . branding . primary ,
27+ color : textColor ?? theme . colors . background . base ,
28+ backgroundColor : backgroundColor ?? theme . colors . branding . primary ,
2729 fontSize : 16 ,
2830 padding : 10 ,
2931 } }
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ interface AdditionalSectionListProps<T> {
2121 } ) => JSX . Element ;
2222 keyExtractor ?: ( item : T , index : number ) => string ;
2323 listComponent ?: ListComponentType ;
24+ sectionHeaderBackgroundColor ?: string ;
25+ sectionHeaderTextColor ?: string ;
2426}
2527
2628export type FlatListSectionListProps < T > = Omit < FlatListProps < T > , "renderItem" > &
@@ -55,6 +57,8 @@ const SectionList = React.forwardRef(
5557 data : dataProp ,
5658 renderItem : renderItemProp ,
5759 keyExtractor : keyExtractorProp ,
60+ sectionHeaderBackgroundColor,
61+ sectionHeaderTextColor,
5862 ...rest
5963 } : FlatListSectionListProps < T > | FlashListSectionListProps < T > ,
6064 ref : React . Ref < FlatListComponent | FlashList < any > >
@@ -164,7 +168,11 @@ const SectionList = React.forwardRef(
164168 } ) ;
165169 return (
166170 extractSectionHeader ( renderedItem ) || (
167- < DefaultSectionHeader title = { item . title } />
171+ < DefaultSectionHeader
172+ title = { item . title }
173+ backgroundColor = { sectionHeaderBackgroundColor }
174+ textColor = { sectionHeaderTextColor }
175+ />
168176 )
169177 ) ;
170178 }
You can’t perform that action at this time.
0 commit comments