Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@React-native-community/react-native-device-info: NativeModule.RNDeviceInfo is null. To fix this issue these steps: *Run 'react-native link

I just created the app with "react-native init NameProject" and had a Base directory that I use constantly, so when I inserted it, I installed the dependencies and link, it happens to me ... I already deleted the "node_modules" directory, reinstalled, re -linked and nothing seems to solve the problem ...

Screenshot:

enter image description here

like image 812
Murilo Mattioli Avatar asked Aug 02 '19 02:08

Murilo Mattioli


2 Answers

Try running the command

react-native link react-native-device-info

or

cd ios && pod install && cd ..

Then try running your project again using whichever command you used to start your application react-native run-android or react-native run-ios or directly run the app from XCode.

Because starting react-native 0.60.0 or newer, most but NOT all libraries can auto-link their native modules without running react-native link package_name. And from what I've tried myself, since react-native-device-info isn't very actively updating themselves, because there isn't much reason to, they doesn't support the auto-link thing (turns out they do, but maybe on some project it doesn't work as well? at least it doesn't on mine, and I need to link it manually).

Actually, the error message itself is already quite descriptive on how to fix your problem if you actually try reading it carefully.

like image 134
JaKK's Team Avatar answered Oct 04 '22 11:10

JaKK's Team


Isn't available for expo anymore, see this post.

You should be able to replace most common properties with expo-constants and expo-device instead.

Source: https://forums.expo.dev/t/nativemodule-rndeviceinfo-is-null/35351

like image 33
User Rebo Avatar answered Oct 04 '22 12:10

User Rebo