Skip to content

Commit 3f768ed

Browse files
authored
closes #82 Enable prop to disable resetScrollToCoords (#96)
Solved small issue with props
1 parent 641352f commit 3f768ed

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/KeyboardAwareMixin.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ const KeyboardAwareMixin = {
1414
enableAutoAutomaticScroll: PropTypes.bool,
1515
extraHeight: PropTypes.number,
1616
extraScrollHeight: PropTypes.number,
17+
enableResetScrollToCoords: PropTypes.bool,
1718
},
1819

1920
getDefaultProps: function () {
2021
return {
2122
enableAutoAutomaticScroll: true,
2223
extraHeight: _KAM_EXTRA_HEIGHT,
2324
extraScrollHeight: 0,
25+
enableResetScrollToCoords: true,
2426
}
2527
},
2628

@@ -82,7 +84,9 @@ const KeyboardAwareMixin = {
8284
const keyboardSpace: number = (this.props.viewIsInsideTabBar) ? _KAM_DEFAULT_TAB_BAR_HEIGHT + this.props.extraScrollHeight : this.props.extraScrollHeight
8385
this.setState({keyboardSpace})
8486
// Reset scroll position after keyboard dismissal
85-
if (this.resetCoords) {
87+
if (this.props.enableResetScrollToCoords === false) {
88+
return
89+
} else if (this.resetCoords) {
8690
this.scrollToPosition(this.resetCoords.x, this.resetCoords.y, true)
8791
} else {
8892
this.scrollToPosition(this.defaultResetScrollToCoords.x, this.defaultResetScrollToCoords.y, true)

0 commit comments

Comments
 (0)