@@ -4,6 +4,8 @@ import { PropTypes } from 'react'
44import ReactNative , { TextInput , Keyboard , UIManager } from 'react-native'
55import TimerMixin from 'react-timer-mixin'
66
7+ import type { Event } from 'react-native'
8+
79const _KAM_DEFAULT_TAB_BAR_HEIGHT : number = 49
810const _KAM_KEYBOARD_OPENING_TIME : number = 250
911const _KAM_EXTRA_HEIGHT : number = 75
@@ -127,15 +129,21 @@ const KeyboardAwareMixin = {
127129 /**
128130 * @param extraHeight: takes an extra height in consideration.
129131 */
130- scrollToFocusedInput: function ( reactNode : Object , extraHeight : number = this . props . extraHeight ) {
132+ scrollToFocusedInput: function ( reactNode : Object , extraHeight : number ) {
133+ if ( extraHeight === undefined ) {
134+ extraHeight = this . props . extraHeight ;
135+ }
131136 this . setTimeout ( ( ) => {
132137 this . getScrollResponder ( ) . scrollResponderScrollNativeHandleToKeyboard (
133138 reactNode , extraHeight , true
134139 )
135140 } , _KAM_KEYBOARD_OPENING_TIME )
136141 } ,
137142
138- scrollToFocusedInputWithNodeHandle : function ( nodeID : number , extraHeight : number = this . props . extraHeight ) {
143+ scrollToFocusedInputWithNodeHandle : function ( nodeID : number , extraHeight : number ) {
144+ if ( extraHeight === undefined ) {
145+ extraHeight = this . props . extraHeight ;
146+ }
139147 const reactNode = ReactNative . findNodeHandle ( nodeID )
140148 this . scrollToFocusedInput ( reactNode , extraHeight + this . props . extraScrollHeight )
141149 } ,
@@ -144,7 +152,7 @@ const KeyboardAwareMixin = {
144152
145153 defaultResetScrollToCoords : null , // format: {x: 0, y: 0}
146154
147- handleOnScroll : function ( e ) {
155+ handleOnScroll : function ( e : Event ) {
148156 this . position = e . nativeEvent . contentOffset
149157 } ,
150158}
0 commit comments