Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Android: screenPhysicalPixels.width is undefined

I recently upgraded to RN 0.20 and I now have the following exception thrown when I try to load my app:

undefined is not an object (evaluating 'screenPhyisicalPixels.width')
<unknown>
index.android.bundle?platform=android& def=true:32950
requireImpl
index.android.bundle?platform=android& def=true:76
_require
index.android.bundle?platform=android& def=true:36

Which apparently causes a JS error the following file:

node_modules/react-native/Libraries/Utilities/Dimensions.js at line 30

For info, I'm not using the Dimensions API in my app.

Any tip on this?

like image 611
Augustin Riedinger Avatar asked Feb 07 '23 16:02

Augustin Riedinger


1 Answers

You need to update the string in android/app/build.gradle to

dependencies {
    compile "com.facebook.react:react-native:0.20.+"
}

Then just run

npm start
react-native run-android
like image 87
Matija Grcic Avatar answered Feb 10 '23 23:02

Matija Grcic