Search code examples
exporeact-native-ui-kitten

React-device-info issue in expo and ui-kitten


Good morning every body,

I'm having an issue using expo and ui-kitten. I'm pretty much familiar with react-native-element as UI library for react native. But I found out that ui-kitten has some stunning features for theming and styling in react-native, expo and I follow this link https://github.com/akveo/react-native-ui-kitten explained by https://justinnoel.dev/2019/12/21/create-universal-react-native-apps-using-expo-for-web-and-ui-kitten.

In the app's directory I have the regular expo folders and another folder src where ui-kitten components rely. But When trying to design my app using ui-kitten glossary, I was asked to install @react-native-community/react-device-info which is used by a component inside node-module. The problem occurs when I use DateFns in the app to parse and format dates. Install @ui-kitten/date-fns ends up with this error " Error @react-native-community/react-device-info : NativeModule.RNDevice is null ". I tried the suggested steps by stack trace:

  1. To link react-device-info to react-native if my react native version was <=0.59, but mine is 0.61.4
  2. To instal pod if I was using cocoa pod, but I'm not.
  3. To rebuilt and re-run ( I rebuilt and re-run using same steps and got same result). The screen is here enter image description here

So how can I fix this error which to me seem to be having no real clue whether it's from expo's dependencies or from a bug inside ui-kitten modules, or a conflict between the two. Any help will be much appreciated !

  • THIS IS MY CONTEXT:

    • The main goal is to use ui-kitten along with expo features
    • I run the app on android emulator
    • The problem started after installing date-fns. Is expo not able to retrieve native data such as date time or calendar from device? How to fix that.

    Thanks in advance.


Solution

  • There are two way to troubleshoot this issue, by ejecting expo or by rebuilding another app. The fact is that expo does not support native modules such as device time or geolocation, I just forgot. That said using device's properties with expo is not feasible. So the first approach is to eject expo by running expo eject. But it goes across the bord that expo has some facilities regarding dependencies and deployments. So the best option is to rebuild another expo app with ui-kitten but avoiding to use any feature from react-native and ui-kitten that calls the device info, and after deployment add the functionalities of the app that require the device's features such camera, geolocation or device's date and time.