2
2
import React , { Component } from 'react' ;
3
3
import PropTypes from 'prop-types' ;
4
4
import { Animated , ScrollView , StyleSheet , View } from 'react-native' ;
5
+ import type { ViewProps } from 'ViewPropTypes' ;
5
6
6
7
export type Props = {
7
8
children ?: ?React$Element < any > ,
@@ -17,6 +18,8 @@ export type Props = {
17
18
renderForeground : ( ) => React$Element < any > ,
18
19
renderHeader : ( ) => React$Element < any > ,
19
20
renderTouchableFixedForeground ?: ?( ) => React$Element < any > ,
21
+ style ?: $PropertyType < ViewProps , 'style' > ,
22
+ onScroll ?: ?Function ,
20
23
} ;
21
24
22
25
export type DefaultProps = {
@@ -216,6 +219,8 @@ class ImageHeaderScrollView extends Component<Props, State> {
216
219
renderForeground,
217
220
renderHeader,
218
221
renderTouchableFixedForeground,
222
+ style,
223
+ onScroll,
219
224
...scrollViewProps
220
225
} = this . props ;
221
226
/* eslint-enable no-unused-vars */
@@ -239,12 +244,15 @@ class ImageHeaderScrollView extends Component<Props, State> {
239
244
< Animated . View style = { [ styles . container , { transform : [ { translateY : topMargin } ] } ] } >
240
245
< ScrollView
241
246
ref = { ref => ( this . scrollViewRef = ref ) }
242
- style = { styles . container }
243
247
scrollEventThrottle = { 16 }
244
- onScroll = { Animated . event ( [
245
- { nativeEvent : { contentOffset : { y : this . state . scrollY } } } ,
246
- ] ) }
247
248
{ ...scrollViewProps }
249
+ style = { [ styles . container , style ] }
250
+ onScroll = { Animated . event (
251
+ [ { nativeEvent : { contentOffset : { y : this . state . scrollY } } } ] ,
252
+ {
253
+ listener : onScroll ,
254
+ }
255
+ ) }
248
256
>
249
257
< Animated . View style = { childrenContainerStyle } > { children } </ Animated . View >
250
258
</ ScrollView >
0 commit comments