Is there a way to convert a react-native app from npx to Expo? - react-native

Having successfully ejected a react-native app first created using 'expo init' with the 'expo eject' command, I was wondering if there is a way to go the other way?

NO. You cannot go back to expo again after you have ejected from expo to a bare react-native app becuase now your code is splitted into two halves, one in android directory and ios directory.
There's no going back around, but you can use the expo libraries which you were using in expo , by simply installing rn-unimodules in your react native project.
Hope it helps .feel free for doubts

Related

Can I use Expo to run a react-native project created by RN CLI?

I was wondering if I could use Expo to run the react-native project that I created using the npx react-native init command, since it generates a better structure for real-world applications.
The reason I want to do this is to avoid the countless erros that I had while running and debugging the app.
You can't do that..
React native and expo are different.
You can run expo projects on react native by detaching them. Expo has limitations.
You can not run react native projects on expo, i.e projects made by react native init/npx can't run on expo
You can use a package made available by the expo
react-native-unimodules
for any React Native project using some resources made available by the expo.
react-native-unimodules

Expo React-Native App doesn't work when run as a standalone APK

My Expo-based React Native App works without a problem when run in the Expo tool but gave the following errors when built as an APK to be installed and run standalone.
A series of white screens keep flipping before the blue screen comes up.
Here are my App.JSON and Package.JSON files
Package.json
App.json
And here are the screen capturing the error message.
Actually there are two ways to create a React Native application
create-react-native-app (CRNA)
react-native init
As you stated in comment section, You created your project using CRNA
CRNA will gave you some form of solid project structure, which is really useful for beginners to get started with react native, you code the app with pure javascript and the app will work inside Expo.
Now if you want to take build and run as a standalone apk for android,
There are two methods
You can run command: exp publish:android
You can eject your app from expo
Dont use exp publish for standalone apks,
You can use second method:
To eject your app:
First if you dont use any expo apis inside your apps, it is very easy to eject and build as a stand alone apk.
just do yarn eject
This will gave you some instructions and follow that.
After that your CRNA project structure will be converted into react-native init project structure, now you will be able to see "Android" and "iOS" folders inside your application
To take build Run: connect your phone with USB debugging ON and react-native run android.
That's all.
Solved my own problem. The 'eth-lightwallet' library works perfectly within the Expo development tool but when I build into an APK, it just made the white screen turns up with no meaningful error messages.
The solution is to replace it with a pure web3js implementation.
This may be useful if you are developing a mobile app for Ethereum.

How to transfer EXPO project to React Native project?

I build an app with Expo tool .. but now I what to move to react native without expo .. I tried to just create a new project in react native and then transfer the code that I had written and install components that I had used in my app .
the app with Expo work as expected put with moved to react native without Expo works as unexpected and crashes.
you don't need to transfer the code like that, the expo provides us to detach our code from expo to without expo react-native projects.
please refer to this link expokit eject
if you want to use expo API in your project then you can detach your app using detach-with-expokit.
use expo eject to add ExpoKit (choose the "ExpoKit" option).

differences between create-react-native-app and exp init

I found that create-react-native-app is based on expo. but when using exp-cli, it is also based on Expo.
what are differences between create-react-native-app and exp init ?
Updated answer:
create-react-native-app was replaced by expo-cli.
https://docs.expo.io/workflow/glossary-of-terms/#create-react-native-app
Answer to this question is well documented in expo documentation
Expo & "Create React Native App"
Create React Native App lets you build a React Native app without any
build configuration. This may sound familiar to you because Expo does
this as well -- when you create a project with XDE or exp you don't
have to deal with Xcode or Android Studio configuration files, it just
works. This guide is intended to outline some of the key differences
between Expo and CRNA (create-react-native-app).
CRNA does not require you to have an Expo account
You can run create-react-native-app YourAppName and off you go. So what does not
having an account mean, and what would signing up and using XDE/exp
get you -- why do we require it with Expo? Having an Expo account
allows you to do the following:
Publish your project to a permanent URL, eg:https://expo.io/#community/reactconf2017.See Publishing on Expo for more information.
Build binaries for app / play store distribution. To do this with CRNA without using Expo,
you would need to run eject.
There are advantages and disadvantages to either:
React Native app advantage:
You can add native modules written in Java/Objective-C
React Native app disadvantage:
Needs Android Studio and XCode to run the projects
Expo advantages:
Setting up a project is easy and can be done in minutes
Expo can build .apk and .ipa files
You do not need simulator to run your app.
Expo disadvantages:
You can't add native modules.
Your final app will bigger with expo init than with react native app init.
I suggest you read this:
https://docs.expo.io/versions/latest/introduction/why-not-expo

Upgrading a project from react-native to create-react-native-app?

I'm trying to use create-react-native-app as per the documentation with an example project that was built using instructions for react-native.
In terms of translating from one to the other what are the steps involved?
Edit: So i can run the app using npm start, with the expo.io QR code appearing as an option etc?
Create-react-native-app create a new project with Expo, you can eject it to turn it into a react-native project (android/ios folders with native code + src folder with javascript code).
You'll need an Xcode/Android Studio environment to run a react-native app built without Expo.
You can't use Expo to run a React-Native app with custom native code.
Related links : Ejecting from Create React Native App
What is the difference between Expo and React Native?