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 @@ -18,6 +18,8 @@ interface AdditionalSectionListProps<T> {
1818 } ) => JSX . Element ;
1919 keyExtractor ?: ( item : T , index : number ) => string ;
2020 listComponent ?: ListComponentType ;
21+ sectionHeaderBackgroundColor ?: string ;
22+ sectionHeaderTextColor ?: string ;
2123}
2224
2325export type FlatListSectionListProps < T > = Omit < FlatListProps < T > , "renderItem" > &
@@ -52,6 +54,8 @@ const SectionList = React.forwardRef(
5254 data : dataProp ,
5355 renderItem : renderItemProp ,
5456 keyExtractor : keyExtractorProp ,
57+ sectionHeaderBackgroundColor,
58+ sectionHeaderTextColor,
5559 ...rest
5660 } : FlatListSectionListProps < T > | FlashListSectionListProps < T > ,
5761 ref : React . Ref < FlatListComponent | FlashList < any > >
@@ -161,7 +165,11 @@ const SectionList = React.forwardRef(
161165 } ) ;
162166 return (
163167 extractSectionHeader ( renderedItem ) || (
164- < DefaultSectionHeader title = { item . title } />
168+ < DefaultSectionHeader
169+ title = { item . title }
170+ backgroundColor = { sectionHeaderBackgroundColor }
171+ textColor = { sectionHeaderTextColor }
172+ />
165173 )
166174 ) ;
167175 }
You can’t perform that action at this time.
0 commit comments