Skip to content

Commit 07c0672

Browse files
authored
Added extraHeight prop (#32)
1 parent a428194 commit 07c0672

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/KeyboardAwareMixin.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ import TimerMixin from 'react-timer-mixin'
66

77
const _KAM_DEFAULT_TAB_BAR_HEIGHT = 49
88
const _KAM_KEYBOARD_OPENING_TIME = 250
9+
const _KAM_EXTRA_HEIGHT = 75
910

1011
const KeyboardAwareMixin = {
1112
mixins: [TimerMixin],
1213
propTypes: {
13-
enableAutoAutomaticScroll: PropTypes.bool
14+
enableAutoAutomaticScroll: PropTypes.bool,
15+
extraHeight: PropTypes.number,
1416
},
1517

1618
getDefaultProps: function () {
1719
return {
1820
enableAutoAutomaticScroll: true,
21+
extraHeight: _KAM_EXTRA_HEIGHT,
1922
}
2023
},
2124

@@ -87,7 +90,7 @@ const KeyboardAwareMixin = {
8790
/**
8891
* @param extraHeight: takes an extra height in consideration.
8992
*/
90-
scrollToFocusedInput: function (reactNode: Object, extraHeight: number = _KAM_DEFAULT_TAB_BAR_HEIGHT) {
93+
scrollToFocusedInput: function (reactNode: Object, extraHeight: number = this.props.extraHeight) {
9194
const scrollView = this.refs._rnkasv_keyboardView.getScrollResponder()
9295
this.setTimeout(() => {
9396
scrollView.scrollResponderScrollNativeHandleToKeyboard(
@@ -96,7 +99,7 @@ const KeyboardAwareMixin = {
9699
}, _KAM_KEYBOARD_OPENING_TIME)
97100
},
98101

99-
scrollToFocusedInputWithNodeHandle: function (nodeID: number, extraHeight: number = _KAM_DEFAULT_TAB_BAR_HEIGHT) {
102+
scrollToFocusedInputWithNodeHandle: function (nodeID: number, extraHeight: number = this.props.extraHeight) {
100103
const reactNode = ReactNative.findNodeHandle(nodeID)
101104
this.scrollToFocusedInput(reactNode, extraHeight)
102105
},

0 commit comments

Comments
 (0)