File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
ReactAndroid/src/main/java/com/facebook/react/uimanager Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1515import java .util .List ;
1616import java .util .Map ;
1717
18+ import android .content .Context ;
19+ import android .os .Build ;
1820import android .util .DisplayMetrics ;
21+ import android .view .Display ;
22+ import android .view .WindowManager ;
1923
2024import com .facebook .csslayout .CSSLayoutContext ;
2125import com .facebook .infer .annotation .Assertions ;
@@ -85,6 +89,17 @@ public UIManagerModule(
8589 super (reactContext );
8690 mEventDispatcher = new EventDispatcher (reactContext );
8791 DisplayMetrics displayMetrics = reactContext .getResources ().getDisplayMetrics ();
92+
93+ // Get the real display metrics if we are using API level 17 or higher.
94+ // The real metrics include system decor elements (e.g. soft menu bar).
95+ //
96+ // See: http://developer.android.com/reference/android/view/Display.html#getRealMetrics(android.util.DisplayMetrics)
97+ if (Build .VERSION .SDK_INT >= 17 ) {
98+ WindowManager wm = (WindowManager )reactContext .getApplicationContext ().getSystemService (Context .WINDOW_SERVICE );
99+ Display display = wm .getDefaultDisplay ();
100+ display .getRealMetrics (displayMetrics );
101+ }
102+
88103 DisplayMetricsHolder .setDisplayMetrics (displayMetrics );
89104 mModuleConstants = createConstants (displayMetrics , viewManagerList );
90105 mUIImplementation = uiImplementation ;
You can’t perform that action at this time.
0 commit comments