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:
parent
1dc82a9e5f
commit
8e7ea1179a
|
@ -12,6 +12,7 @@ package com.facebook.react.uimanager;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.concurrent.NotThreadSafe;
|
import javax.annotation.concurrent.NotThreadSafe;
|
||||||
|
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.util.SparseBooleanArray;
|
import android.util.SparseBooleanArray;
|
||||||
import android.view.Menu;
|
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)
|
* which is what measure will return)
|
||||||
*
|
*
|
||||||
* @param tag - the tag for the view
|
* @param tag - the tag for the view
|
||||||
|
@ -499,6 +500,15 @@ public class NativeViewHierarchyManager {
|
||||||
|
|
||||||
v.getLocationOnScreen(outputBuffer);
|
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[0,1] already contain what we want
|
||||||
outputBuffer[2] = v.getWidth();
|
outputBuffer[2] = v.getWidth();
|
||||||
outputBuffer[3] = v.getHeight();
|
outputBuffer[3] = v.getHeight();
|
||||||
|
|
Loading…
Reference in New Issue