mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00: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
@@ -23,7 +23,7 @@ public class PixelUtil {
|
||||
return TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
value,
|
||||
DisplayMetricsHolder.getDisplayMetrics());
|
||||
DisplayMetricsHolder.getWindowDisplayMetrics());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ public class PixelUtil {
|
||||
return TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_SP,
|
||||
value,
|
||||
DisplayMetricsHolder.getDisplayMetrics());
|
||||
DisplayMetricsHolder.getWindowDisplayMetrics());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ public class PixelUtil {
|
||||
* Convert from PX to DP
|
||||
*/
|
||||
public static float toDIPFromPixel(float value) {
|
||||
return value / DisplayMetricsHolder.getDisplayMetrics().density;
|
||||
return value / DisplayMetricsHolder.getWindowDisplayMetrics().density;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user