Skip to content

Commit

Permalink
closes APSL#82 Enable prop to disable resetScrollToCoords (APSL#96)
Browse files Browse the repository at this point in the history
Solved small issue with props
  • Loading branch information
alvaromb authored Feb 3, 2017
1 parent 641352f commit 3f768ed
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/KeyboardAwareMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ const KeyboardAwareMixin = {
enableAutoAutomaticScroll: PropTypes.bool,
extraHeight: PropTypes.number,
extraScrollHeight: PropTypes.number,
enableResetScrollToCoords: PropTypes.bool,
},

getDefaultProps: function () {
return {
enableAutoAutomaticScroll: true,
extraHeight: _KAM_EXTRA_HEIGHT,
extraScrollHeight: 0,
enableResetScrollToCoords: true,
}
},

Expand Down Expand Up @@ -82,7 +84,9 @@ const KeyboardAwareMixin = {
const keyboardSpace: number = (this.props.viewIsInsideTabBar) ? _KAM_DEFAULT_TAB_BAR_HEIGHT + this.props.extraScrollHeight : this.props.extraScrollHeight
this.setState({keyboardSpace})
// Reset scroll position after keyboard dismissal
if (this.resetCoords) {
if (this.props.enableResetScrollToCoords === false) {
return
} else if (this.resetCoords) {
this.scrollToPosition(this.resetCoords.x, this.resetCoords.y, true)
} else {
this.scrollToPosition(this.defaultResetScrollToCoords.x, this.defaultResetScrollToCoords.y, true)
Expand Down

0 comments on commit 3f768ed

Please sign in to comment.