react-native-device-info: undefined is not an object (evaluating 'RNDeviceInfo.uniqueId')
Summary
Version | 0.22.2 |
Affected OS | iOS / Android |
OS Version | iOS 11, Android Oreo |
Current behavior
If I call any of the methods, I got an error message:
undefined is not an object (evaluating 'RNDeviceInfo.uniqueId')
Expected behavior
Not get an error message, but see the results from the methods as in the documentation.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19
Anything in an npm
run
script is custom, fully defined by the project. No one else will share that command - I’d always assume I need tocd ios && pod install
After you guys installed it and executed the
react-native link
, try to rebuild the app so it applies the native code changes, it may work.Importing instead of requiring worked for me.
let DeviceInfo = require(‘react-native-device-info’);You must detach your expo so you can link to packages that use native code. See that thread, https://github.com/expo/expo/issues/56, hope it helps ^^