Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Convert Existing React Native to Expo: error with nativeVersion.major

Just downloaded the newest version of Expo XDE(2.20.1) and trying to convert an existing react native project into it. I followed precisely these steps, and when opening the app in Expo client on a real device, I got an error saying:

undefined is not an object (evaluating 'nativeVersion.major')

The problem happens both on Android and iOS.

Seems expo has a strict requirement of react/react-native versions, but unfortunately, I cannot find the version requirement list.

My current dependencies (which are quite up-to-date) are: "react": "16.0.0", "react-native": "0.49.3"

So, does this error indeed came from version conflicts? And if so, how do I solve the problem?

like image 815
Stanley Luo Avatar asked Oct 17 '17 01:10

Stanley Luo


1 Answers

Your JS dependencies need to match the native code. With Expo SDK 21, which is based off of React Native 0.48, you can either use (recommended):

"react": "16.0.0-alpha.12",
"react-native": "https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz",

or:

"react": "16.0.0-alpha.12",
"react-native": "^0.48.4",

It's important you are careful with the versions when you update your dependencies. The upcoming React Native 0.49 (supported with Expo SDK 22) needs to use React 16.0.0-beta.5.

like image 92
ide Avatar answered Oct 22 '22 02:10

ide