Expose screen metrics and window metrics

Summary:
public
https://github.com/facebook/react-native/pull/4935 changed the window dimensions for android by replacing them with the actual screen dimensions. This changes the window dimensions back to their original values and adds `Dimensions.get('screen')` for the actual screen dimensions of the device.

Reviewed By: astreet

Differential Revision: D2921584

fb-gh-sync-id: 5d2677029c71d50691691dc651a11e9c8b115e8f
shipit-source-id: 5d2677029c71d50691691dc651a11e9c8b115e8f
This commit is contained in:
Andrei Coman
2016-02-11 06:32:40 -08:00
committed by facebook-github-bot-3
parent 6f1417c849
commit 228a1fe7d4
16 changed files with 93 additions and 34 deletions

View File

@@ -390,7 +390,7 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
private class KeyboardListener implements ViewTreeObserver.OnGlobalLayoutListener {
private final Rect mVisibleViewArea;
private final int mMinKeyboardHeightDetected;
private int mKeyboardHeight = 0;
/* package */ KeyboardListener() {
@@ -410,7 +410,7 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
getRootView().getWindowVisibleDisplayFrame(mVisibleViewArea);
final int heightDiff =
DisplayMetricsHolder.getDisplayMetrics().heightPixels - mVisibleViewArea.bottom;
DisplayMetricsHolder.getWindowDisplayMetrics().heightPixels - mVisibleViewArea.bottom;
if (mKeyboardHeight != heightDiff && heightDiff > mMinKeyboardHeightDetected) {
// keyboard is now showing, or the keyboard height has changed
mKeyboardHeight = heightDiff;