Skip to content

Commit c9b5e6d

Browse files
committed
Add scrollViewBackgroundColor props
1 parent 72e2806 commit c9b5e6d

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ The `HeaderImageScrollView` handle also the following props. None is required :
7676
| Property | Type | Default | Description |
7777
| -------- | ---- | ------- | ----------- |
7878
| `ScrollViewComponent` | `Component` | `ScrollView` | The component to be used for scrolling. Can be any component with an `onScroll` props (ie. `ListView`, `FlatList`, `SectionList` or `ScrollView`) |
79+
| `scrollViewBackgroundColor` | `string` | `white` | Background color of the scrollView content |
7980

8081

8182
### TriggeringView

src/ImageHeaderScrollView.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export type Props = ScrollViewProps & {
2727
renderHeader: () => React$Element<any>,
2828
renderTouchableFixedForeground?: ?() => React$Element<any>,
2929
ScrollViewComponent: React$ComponentType<ScrollViewProps>,
30+
scrollViewBackgroundColor: string,
3031
};
3132

3233
export type DefaultProps = {
@@ -40,6 +41,7 @@ export type DefaultProps = {
4041
renderFixedForeground: () => React$Element<any>,
4142
renderHeader: () => React$Element<any>,
4243
ScrollViewComponent: React$ComponentType<ScrollViewProps>,
44+
scrollViewBackgroundColor: string,
4345
};
4446

4547
export type State = {
@@ -65,6 +67,7 @@ class ImageHeaderScrollView extends Component<Props, State> {
6567
renderFixedForeground: () => <View />,
6668
renderHeader: () => <View />,
6769
ScrollViewComponent: ScrollView,
70+
scrollViewBackgroundColor: 'white',
6871
};
6972

7073
constructor(props: Props) {
@@ -206,6 +209,7 @@ class ImageHeaderScrollView extends Component<Props, State> {
206209
contentContainerStyle,
207210
onScroll,
208211
ScrollViewComponent,
212+
scrollViewBackgroundColor,
209213
...scrollViewProps
210214
} = this.props;
211215
/* eslint-enable no-unused-vars */
@@ -214,7 +218,13 @@ class ImageHeaderScrollView extends Component<Props, State> {
214218

215219
return (
216220
<View
217-
style={[styles.container, { paddingTop: minHeight }]}
221+
style={[
222+
styles.container,
223+
{
224+
paddingTop: minHeight,
225+
backgroundColor: scrollViewBackgroundColor,
226+
},
227+
]}
218228
ref={ref => (this.container = ref)}
219229
onLayout={this.onContainerLayout}
220230
>
@@ -226,7 +236,7 @@ class ImageHeaderScrollView extends Component<Props, State> {
226236
{...scrollViewProps}
227237
contentContainerStyle={[
228238
{
229-
backgroundColor: 'white',
239+
backgroundColor: scrollViewBackgroundColor,
230240
marginTop: inset,
231241
paddingBottom: inset,
232242
},

0 commit comments

Comments
 (0)