Reputation: 21
I am pretty new to React Native and want to convert my React-Native app to expo, in order to be able to start testing. This is however not as easy as I thought it would be.
I already read that the 'exp convert' does not work and that the 'expo init' and creating a new project, copying the code and 'yarn add'ing the dependencies is the easiest way to do it right now. But. I don't find it all that easy.
I think it might be because I do not fully understand the 'yarn add' dependencies from the old project
I copied the the folders, containing source code from the react-native project to the new expo project, and copied the dependencies from that same project to the new one. Then I ran 'yarn install'.
However when I 'expo start' the new project and fire the iOS simulator I get the following error:
ERROR
14:06
Error running xcrun simctl boot AD3359F1-A3C7-4AEA-923B-E0DC7701FA8B
: An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=164):
Unable to boot device in current state: Booted
ERROR
14:06
There was a problem booting a device in iOS Simulator. Quit Simulator, and try again.
ERROR
14:06
Error installing or running app. Error: xcrun exited with non-zero code: 164
When I then open the app in the simulator following error shows: * No bundle URL present.
Make sure you're running a packager server or have included a .jsbundle file in your application bundle.
RCTFatal 28-[RCTCxxBridge handleError:]_block_invoke _dispatch_call_block_and_release _dispatch_client_callout _dispatch_main_queue_callback_4CF __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE __CFRunLoopRun CFRunLoopRunSpecific GSEventRunModal UIApplicationMain main start 0x0 *
Can someone please explain thoroughly how to convert a React-native app to Expo?
Upvotes: 0
Views: 3505
Reputation: 31
Also yarn add-ing(as you meantion that you didn't fully understand) these dependencies meant to put them back in the new project one by one.
Example:
yarn add @react-native-community/slider - to install a slider
yarn add ...
Then all of them like so
But it's easier as you did to copy your package.json, which contains information about all of them. Then 'yarn install' or 'npm install' and install them into your new project so you can use them.
Upvotes: 0
Reputation: 21
solved it by literally copying my dependencies from package.json, which wasn't already in the new expo project.
Then i ran 'yarn install' in the terminal.
I then copied my source code, including my app.js and index.js which then got it to crash. Figured out that it worked without the index.js file.
Then another problem was an Error: Tried to register two views with the same name RNGestureHandlerButton
This was because one of my dependencies was : "react-native-gesture-handler": "^1.1.0", which I deleted as I found out that it is already included in the expo package.
I then deleted my yarn.lock and node_modules and ran 'yarn install' again. It works now.
Upvotes: 1