Skip to content

Commit ea92c53

Browse files
committed
support propagating onScroll events (issue wix-incubator#7)
1 parent 2f6f8f5 commit ea92c53

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/KeyboardAwareListView.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import React from 'react';
2+
import React, {PropTypes} from 'react';
33

44
import {
55
ListView
@@ -21,7 +21,10 @@ export default class KeyboardAwareListView extends KeyboardAwareBase {
2121
this._onKeyboardAwareViewLayout(layoutEvent.nativeEvent.layout);
2222
}}
2323
onScroll={(event) => {
24-
this._onKeyboardAwareViewScroll(event.nativeEvent.contentOffset)
24+
this._onKeyboardAwareViewScroll(event.nativeEvent.contentOffset);
25+
if(this.props.onScroll) {
26+
this.props.onScroll(event);
27+
}
2528
}}
2629
onContentSizeChange={() => {
2730
this._updateKeyboardAwareViewContentSize();
@@ -31,3 +34,7 @@ export default class KeyboardAwareListView extends KeyboardAwareBase {
3134
);
3235
}
3336
}
37+
38+
KeyboardAwareListView.propTypes = {
39+
onScroll: PropTypes.func
40+
};

src/KeyboardAwareScrollView.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ export default class KeyboardAwareScrollView extends KeyboardAwareBase {
1818
this._onKeyboardAwareViewLayout(layoutEvent.nativeEvent.layout);
1919
}}
2020
onScroll={(event) => {
21-
this._onKeyboardAwareViewScroll(event.nativeEvent.contentOffset)
21+
this._onKeyboardAwareViewScroll(event.nativeEvent.contentOffset);
22+
if(this.props.onScroll) {
23+
this.props.onScroll(event);
24+
}
2225
}}
2326
onContentSizeChange={() => {
2427
this._updateKeyboardAwareViewContentSize();
@@ -30,7 +33,8 @@ export default class KeyboardAwareScrollView extends KeyboardAwareBase {
3033
}
3134

3235
KeyboardAwareScrollView.propTypes = {
33-
getTextInputRefs: PropTypes.func
36+
getTextInputRefs: PropTypes.func,
37+
onScroll: PropTypes.func
3438
};
3539
KeyboardAwareScrollView.defaultProps = {
3640
getTextInputRefs: () => {

0 commit comments

Comments
 (0)