mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-15 23:03:58 +08:00
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:
committed by
facebook-github-bot-3
parent
6f1417c849
commit
228a1fe7d4
@@ -91,7 +91,8 @@ import com.facebook.react.uimanager.events.TouchEventType;
|
||||
"ScaleAspectFill",
|
||||
ImageView.ScaleType.CENTER_CROP.ordinal())));
|
||||
|
||||
DisplayMetrics displayMetrics = DisplayMetricsHolder.getDisplayMetrics();
|
||||
DisplayMetrics displayMetrics = DisplayMetricsHolder.getWindowDisplayMetrics();
|
||||
DisplayMetrics screenDisplayMetrics = DisplayMetricsHolder.getScreenDisplayMetrics();
|
||||
constants.put(
|
||||
"Dimensions",
|
||||
MapBuilder.of(
|
||||
@@ -106,7 +107,19 @@ import com.facebook.react.uimanager.events.TouchEventType;
|
||||
"fontScale",
|
||||
displayMetrics.scaledDensity,
|
||||
"densityDpi",
|
||||
displayMetrics.densityDpi)));
|
||||
displayMetrics.densityDpi),
|
||||
"screenPhysicalPixels",
|
||||
MapBuilder.of(
|
||||
"width",
|
||||
screenDisplayMetrics.widthPixels,
|
||||
"height",
|
||||
screenDisplayMetrics.heightPixels,
|
||||
"scale",
|
||||
screenDisplayMetrics.density,
|
||||
"fontScale",
|
||||
screenDisplayMetrics.scaledDensity,
|
||||
"densityDpi",
|
||||
screenDisplayMetrics.densityDpi)));
|
||||
|
||||
constants.put(
|
||||
"StyleConstants",
|
||||
|
||||
Reference in New Issue
Block a user