File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/components/KeyboardCompatibleView Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212 LayoutRectangle ,
1313 Platform ,
1414 ScreenRect ,
15+ StatusBar ,
1516 StyleSheet ,
1617 View ,
1718} from 'react-native' ;
@@ -59,11 +60,24 @@ export class KeyboardCompatibleView extends React.Component<
5960 }
6061
6162 const keyboardY =
62- keyboardFrame . screenY - ( this . props . keyboardVerticalOffset as number ) ;
63+ keyboardFrame . screenY - ( this . props . keyboardVerticalOffset ?? 0 ) ;
64+ const relativeHeight = frame . y + frame . height - keyboardY ;
65+
66+ /**
67+ * When the StatusBar is translucent there is an issue
68+ * where the relative keyboard height is returned as the StatusBar
69+ * height instead of 0 when closed.
70+ */
71+ if (
72+ Platform . OS === 'android' &&
73+ relativeHeight === StatusBar . currentHeight
74+ ) {
75+ return 0 ;
76+ }
6377
6478 // Calculate the displacement needed for the view such that it
6579 // no longer overlaps with the keyboard
66- return Math . max ( frame . y + frame . height - keyboardY , 0 ) ;
80+ return Math . max ( relativeHeight , 0 ) ;
6781 }
6882
6983 _onKeyboardChange : KeyboardEventListener = ( event ) => {
You can’t perform that action at this time.
0 commit comments