Fix Popover location in Events

Reviewed By: andreicoman11

Differential Revision: D3219054

fb-gh-sync-id: cc25bd63be284ae7e8232652936a67fd792feabc
fbshipit-source-id: cc25bd63be284ae7e8232652936a67fd792feabc
This commit is contained in:
Dave Miller 2016-04-25 10:14:14 -07:00 committed by Facebook Github Bot 4
parent 1dc82a9e5f
commit 8e7ea1179a
1 changed files with 11 additions and 1 deletions

View File

@ -12,6 +12,7 @@ package com.facebook.react.uimanager;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
import android.content.res.Resources;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.view.Menu;
@ -483,7 +484,7 @@ public class NativeViewHierarchyManager {
}
/**
* Returns the coordinates of a view relative to the entire phone screen (not just the RootView
* Returns the coordinates of a view relative to the window (not just the RootView
* which is what measure will return)
*
* @param tag - the tag for the view
@ -499,6 +500,15 @@ public class NativeViewHierarchyManager {
v.getLocationOnScreen(outputBuffer);
// We need to remove the status bar from the height. getLocationOnScreen will include the
// status bar.
Resources resources = v.getContext().getResources();
int statusBarId = resources.getIdentifier("status_bar_height", "dimen", "android");
if (statusBarId > 0) {
int height = (int) resources.getDimension(statusBarId);
outputBuffer[1] -= height;
}
// outputBuffer[0,1] already contain what we want
outputBuffer[2] = v.getWidth();
outputBuffer[3] = v.getHeight();