@@ -389,11 +389,13 @@ private KeyboardListener getKeyboardListener() {
389389
390390 private class KeyboardListener implements ViewTreeObserver .OnGlobalLayoutListener {
391391 private final Rect mVisibleViewArea ;
392-
392+ private final int mMinKeyboardHeightDetected ;
393+
393394 private int mKeyboardHeight = 0 ;
394395
395396 /* package */ KeyboardListener () {
396397 mVisibleViewArea = new Rect ();
398+ mMinKeyboardHeightDetected = (int ) PixelUtil .toPixelFromDIP (60 );
397399 }
398400
399401 @ Override
@@ -409,7 +411,7 @@ public void onGlobalLayout() {
409411 getRootView ().getWindowVisibleDisplayFrame (mVisibleViewArea );
410412 final int heightDiff =
411413 DisplayMetricsHolder .getDisplayMetrics ().heightPixels - mVisibleViewArea .bottom ;
412- if (mKeyboardHeight != heightDiff && heightDiff > 0 ) {
414+ if (mKeyboardHeight != heightDiff && heightDiff > mMinKeyboardHeightDetected ) {
413415 // keyboard is now showing, or the keyboard height has changed
414416 mKeyboardHeight = heightDiff ;
415417 WritableMap params = Arguments .createMap ();
@@ -420,9 +422,9 @@ public void onGlobalLayout() {
420422 coordinates .putDouble ("height" , PixelUtil .toDIPFromPixel (mKeyboardHeight ));
421423 params .putMap ("endCoordinates" , coordinates );
422424 sendEvent ("keyboardDidShow" , params );
423- } else if (mKeyboardHeight != 0 && heightDiff == 0 ) {
425+ } else if (mKeyboardHeight != 0 && heightDiff <= mMinKeyboardHeightDetected ) {
424426 // keyboard is now hidden
425- mKeyboardHeight = heightDiff ;
427+ mKeyboardHeight = 0 ;
426428 sendEvent ("keyboardDidHide" , null );
427429 }
428430 }
0 commit comments