22import React , { Component } from 'react' ;
33import PropTypes from 'prop-types' ;
44import { Animated , ScrollView , StyleSheet , View } from 'react-native' ;
5+ import type { ViewProps } from 'ViewPropTypes' ;
56
67export type Props = {
78 children ?: ?React$Element < any > ,
@@ -17,6 +18,8 @@ export type Props = {
1718 renderForeground : ( ) => React$Element < any > ,
1819 renderHeader : ( ) => React$Element < any > ,
1920 renderTouchableFixedForeground ?: ?( ) => React$Element < any > ,
21+ style ?: $PropertyType < ViewProps , 'style' > ,
22+ onScroll ?: ?Function ,
2023} ;
2124
2225export type DefaultProps = {
@@ -216,6 +219,8 @@ class ImageHeaderScrollView extends Component<Props, State> {
216219 renderForeground,
217220 renderHeader,
218221 renderTouchableFixedForeground,
222+ style,
223+ onScroll,
219224 ...scrollViewProps
220225 } = this . props ;
221226 /* eslint-enable no-unused-vars */
@@ -239,12 +244,15 @@ class ImageHeaderScrollView extends Component<Props, State> {
239244 < Animated . View style = { [ styles . container , { transform : [ { translateY : topMargin } ] } ] } >
240245 < ScrollView
241246 ref = { ref => ( this . scrollViewRef = ref ) }
242- style = { styles . container }
243247 scrollEventThrottle = { 16 }
244- onScroll = { Animated . event ( [
245- { nativeEvent : { contentOffset : { y : this . state . scrollY } } } ,
246- ] ) }
247248 { ...scrollViewProps }
249+ style = { [ styles . container , style ] }
250+ onScroll = { Animated . event (
251+ [ { nativeEvent : { contentOffset : { y : this . state . scrollY } } } ] ,
252+ {
253+ listener : onScroll ,
254+ }
255+ ) }
248256 >
249257 < Animated . View style = { childrenContainerStyle } > { children } </ Animated . View >
250258 </ ScrollView >
0 commit comments