@@ -4,6 +4,8 @@ import { PropTypes } from 'react'
4
4
import ReactNative , { TextInput , Keyboard , UIManager } from 'react-native'
5
5
import TimerMixin from 'react-timer-mixin'
6
6
7
+ import type { Event } from 'react-native'
8
+
7
9
const _KAM_DEFAULT_TAB_BAR_HEIGHT : number = 49
8
10
const _KAM_KEYBOARD_OPENING_TIME : number = 250
9
11
const _KAM_EXTRA_HEIGHT : number = 75
@@ -127,15 +129,21 @@ const KeyboardAwareMixin = {
127
129
/**
128
130
* @param extraHeight: takes an extra height in consideration.
129
131
*/
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
+ }
131
136
this . setTimeout ( ( ) => {
132
137
this . getScrollResponder ( ) . scrollResponderScrollNativeHandleToKeyboard (
133
138
reactNode , extraHeight , true
134
139
)
135
140
} , _KAM_KEYBOARD_OPENING_TIME )
136
141
} ,
137
142
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
+ }
139
147
const reactNode = ReactNative . findNodeHandle ( nodeID )
140
148
this . scrollToFocusedInput ( reactNode , extraHeight + this . props . extraScrollHeight )
141
149
} ,
@@ -144,7 +152,7 @@ const KeyboardAwareMixin = {
144
152
145
153
defaultResetScrollToCoords : null , // format: {x: 0, y: 0}
146
154
147
- handleOnScroll : function ( e ) {
155
+ handleOnScroll : function ( e : Event ) {
148
156
this . position = e . nativeEvent . contentOffset
149
157
} ,
150
158
}
0 commit comments