File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
android/src/main/java/ca/jaysoo/extradimensions Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -103,16 +103,12 @@ private float getSoftMenuBarHeight(DisplayMetrics metrics) {
103103 if (hasPermanentMenuKey ()) {
104104 return 0 ;
105105 }
106- final float realHeight = getRealHeight (metrics );
107106 final Context ctx = getReactApplicationContext ();
108- final DisplayMetrics usableMetrics = ctx .getResources ().getDisplayMetrics ();
109-
110- // Passing getMetrics will update the value of the Object DisplayMetrics metrics
111- ((WindowManager ) mReactContext .getSystemService (Context .WINDOW_SERVICE ))
112- .getDefaultDisplay ().getMetrics (metrics );
113- final int usableHeight = usableMetrics .heightPixels ;
114-
115- return Math .max (0 , realHeight - usableHeight / metrics .density );
107+ final int heightResId = ctx .getResources ().getIdentifier ("navigation_bar_height" , "dimen" , "android" );
108+ return
109+ heightResId > 0
110+ ? ctx .getResources ().getDimensionPixelSize (heightResId ) / metrics .density
111+ : 0 ;
116112 }
117113
118114 private float getRealHeight (DisplayMetrics metrics ) {
You can’t perform that action at this time.
0 commit comments