1
1
/* @flow */
2
2
3
3
import { PropTypes } from 'react'
4
- import ReactNative , { TextInput , Keyboard , UIManager } from 'react-native'
4
+ import ReactNative , { TextInput , Keyboard , UIManager , Platform } from 'react-native'
5
5
import TimerMixin from 'react-timer-mixin'
6
6
7
7
import type { Event } from 'react-native'
@@ -10,6 +10,8 @@ const _KAM_DEFAULT_TAB_BAR_HEIGHT: number = 49
10
10
const _KAM_KEYBOARD_OPENING_TIME : number = 250
11
11
const _KAM_EXTRA_HEIGHT : number = 75
12
12
13
+ var lastKeyboardSpace = 0 ;
14
+
13
15
const KeyboardAwareMixin = {
14
16
mixins : [ TimerMixin ] ,
15
17
propTypes : {
@@ -25,12 +27,13 @@ const KeyboardAwareMixin = {
25
27
extraHeight : _KAM_EXTRA_HEIGHT ,
26
28
extraScrollHeight : 0 ,
27
29
enableResetScrollToCoords : true ,
30
+ viewIsInsideTabBar : true
28
31
}
29
32
} ,
30
33
31
34
setViewIsInsideTabBar : function ( viewIsInsideTabBar : bool ) {
32
35
this . viewIsInsideTabBar = viewIsInsideTabBar
33
- const keyboardSpace = viewIsInsideTabBar ? _KAM_DEFAULT_TAB_BAR_HEIGHT : 0
36
+ const keyboardSpace = lastKeyboardSpace ; // viewIsInsideTabBar ? _KAM_DEFAULT_TAB_BAR_HEIGHT : 0
34
37
if ( this . state . keyboardSpace !== keyboardSpace ) {
35
38
this . setState ( { keyboardSpace} )
36
39
}
@@ -55,6 +58,7 @@ const KeyboardAwareMixin = {
55
58
if ( this . props . viewIsInsideTabBar ) {
56
59
keyboardSpace -= _KAM_DEFAULT_TAB_BAR_HEIGHT
57
60
}
61
+ lastKeyboardSpace = keyboardSpace ;
58
62
this . setState ( { keyboardSpace} )
59
63
// Automatically scroll to focused TextInput
60
64
if ( this . props . enableAutoAutomaticScroll ) {
@@ -86,6 +90,7 @@ const KeyboardAwareMixin = {
86
90
87
91
resetKeyboardSpace : function ( ) {
88
92
const keyboardSpace : number = ( this . props . viewIsInsideTabBar ) ? _KAM_DEFAULT_TAB_BAR_HEIGHT + this . props . extraScrollHeight : this . props . extraScrollHeight
93
+ lastKeyboardSpace = keyboardSpace ;
89
94
this . setState ( { keyboardSpace} )
90
95
// Reset scroll position after keyboard dismissal
91
96
if ( this . props . enableResetScrollToCoords === false ) {
0 commit comments