Commit d324f929 authored by Mehdi Achour's avatar Mehdi Achour

fix: Fix production build crash on Android introduced in #313

Co-authored-by: 's avatarMikael Palm <mikael@flashguru.se>
parent 4743ff4a
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
### next ### next
### 0.17.3
* Fix production build crash on Android introduced in #313
### 0.17.2 ### 0.17.2
* Enhance `isTablet()` for android by checking display density (https://github.com/rebeccahughes/react-native-device-info/pull/313) * Enhance `isTablet()` for android by checking display density (https://github.com/rebeccahughes/react-native-device-info/pull/313)
......
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "RNDeviceInfo" s.name = "RNDeviceInfo"
s.version = "0.17.2" s.version = "0.17.3"
s.summary = "Device Information for react-native" s.summary = "Device Information for react-native"
s.homepage = "https://github.com/rebeccahughes/react-native-device-info" s.homepage = "https://github.com/rebeccahughes/react-native-device-info"
......
...@@ -95,8 +95,8 @@ public class RNDeviceModule extends ReactContextBaseJavaModule { ...@@ -95,8 +95,8 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
if (layout != Configuration.SCREENLAYOUT_SIZE_LARGE && layout != Configuration.SCREENLAYOUT_SIZE_XLARGE) { if (layout != Configuration.SCREENLAYOUT_SIZE_LARGE && layout != Configuration.SCREENLAYOUT_SIZE_XLARGE) {
return false; return false;
} }
DisplayMetrics metrics = new DisplayMetrics();
getCurrentActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); final DisplayMetrics metrics = getReactApplicationContext().getResources().getDisplayMetrics();
if (metrics.densityDpi == DisplayMetrics.DENSITY_DEFAULT if (metrics.densityDpi == DisplayMetrics.DENSITY_DEFAULT
|| metrics.densityDpi == DisplayMetrics.DENSITY_HIGH || metrics.densityDpi == DisplayMetrics.DENSITY_HIGH
|| metrics.densityDpi == DisplayMetrics.DENSITY_MEDIUM || metrics.densityDpi == DisplayMetrics.DENSITY_MEDIUM
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment