Uninstall expo sdk and setup firebase instead - react-native

We developed a React Native application with Expo Kit SDK. Now, We would change the native full Firebase SDK, but before we have to uninstall Expo SDK (Expo doesn't support external native sdk services). Is there a best practice to do that as easy as possible?

Hey I believe for Expo it's called detaching, like CRNA is ejecting...
https://docs.expo.io/versions/latest/expokit/detach
1. Install exp
If you don't have it, run npm install -g exp to get our command line library.
If you haven't used exp or XDE before, the first thing you'll need to do is log in with your Expo account using exp login.
2. Make sure you have the necessary keys in app.json
Detaching requires the same keys as building a standalone app. Follow these instructions before continuing to the next step.
3. Detach
From your project directory, run exp detach. This will download the required dependencies and build native projects under the ios and android directories.
4. Set up and Run your native project
Congrats, you now have a native project with ExpoKit! Follow the directions under Developing with ExpoKit to get things set up and running.
5. Make native changes
You can do whatever you want in the Xcode and Android Studio projects.
To add third-party native modules for React Native, non-Expo-specific instructions such as react-native link should be supported. Read more details about changing native dependencies in your ExpoKit project.

Related

React Native Error - TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNShare.FACEBOOK')

I'm working on react native project and I am using expo. I want to add the react-native-share package to my project, however I keep getting this error before I even add any code.
TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNShare.FACEBOOK')
Now I know that expo has it's own version of the share, however you can't specify where a person can share it too, which honestly makes the feature useless. It seems to be clear that the reason I can't use this package is because I am using expo and can't install pod into the project -- due to expo reject it --. So what should I do? Any suggestions on how to work around this?
You can't normally use dependencies with native code using Expo. At least when using the classic build system (you're using it when you run expo start in the terminal to run your project). react-native-share has native code (you can check that by going to the repo and seeing if the library has ios and android folders) and therefore can't be used with "standard" Expo.
If you want to use custom native code in your project, you either need to eject from Expo to the bare workflow or - a newer option - use Expo EAS and custom dev clients. Expo EAS allows you to stay in the managed workflow and still use native modules. You might need to write something called a config plugin for some of those native dependencies you want to use, but looking at the documentation, react-native-share should be working just fine without a config plugin.
So: Either eject to the Expo bare workflow, or use Expo EAS and custom dev clients to use native dependencies with the Expo managed workflow. Do note however that you need at least Expo SDK 41 to use EAS and custom development clients.
To learn more about migrating from the classic build system to EAS, see Expo's guide / documentation.

Why is that we cannot install native libraries on Expo? (that requires linking)

I am a newbie and learned react-native expo. I am curious why we can't use any native library with Expo.
For example, if I want to use filesystem on expo I just cant use it, I know expo has it's own file system but I want to use another library but that library requires linking so it is not working in expo. Why is that?
I have tried everything.
This is the library that I want to use ==> https://github.com/itinance/react-native-fs
It requires command : react-native link react-native-fs
How do I do it?
You first have to understand the difference between react-native cli & expo
Please read this documentation to understand the difference
React Native expo uses their own servers to compile your javascript into java and return APK file as a complete APP, and that is the reason you do not need android SDKs or android studio environment on your PC when you are using expo
but when you are using react-native cli you do need the android studio environment such as SDKs, because when you are using cli , it compiles the code using that android studio sdk/environment that you made in your PC that is why you do not need a third party server like expo do.
and thats the reason you get android files right in your react-native project and due to which you can add native modules to it.
However you also have the option to use expo-eject, You can read more about expo-eject in this documentation
Thank You!, Have a great day & welcome to stackoverflow community!.

Ejected expo react native app requires expo?

I created a RN with create-react-native-app, and I have now decided to eject. It didn't work initially, and required some packages to be installed (#babel/...), but now, it complains that Module 'expo' does not exist in the Haste module map.
Why does it still require expo, now that it has been ejected? Or have I misunderstood what ejection does?
N.B. during the ejection I chose the option to eject to an RN app, not to ExpoKit. This is on iOS, currently.
When ejecting expo app you'll be asked about using expo-kit or just react-native and it's up to you to choose, plus Module 'expo' does not exist in the Haste module map means you still using expo in your code so double check your code to be sure that you're not importing expo anywhere and try again.
TL;DR
Ejected expo react native app requires expo? the short answer is no.
when using expo app you have the ability to build your app using the expo server so you don't have to have Android Studio or XCode installed all you have to do is $ expo build:[android|ios] and download your built package after the build process is done also you can run your app using expo client app on Android and Ios but once ejecting you'll lose the ability of using expo server as your build environment instead you have to use Android Studio or XCode, but the main difference here is when you choose expo-kit you still have the ability of using expo client to run your app and you still have the ability to use expo modules inside your code but when you choose react-native you can't use expo client instead you have to use the native tools, anyway in all cases once you eject your project you have to build it yourself and you can't undo this step.
Sidenote
You can build very powerful apps using only JavaScript without any need to eject especially when using `expo SDK 31+, I'm working on an app now with features like detecting location, live maps, social login and chat and I don't need to eject it at all.
Please take a look here and here
Update:
One last thing you have to remember is that when using expo or expo-kit you can keep developing ios app on any OS but when using react-native you can't do this you MUST have a mac.

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

Can I not use Expo (cloud service) at all using React Native

I have build an app using react native(detached) but the thing is I would want to completely get rid of Expo. The reason is, what if one day EXPO service get shut down or no more supported.
So in this case I would not want the app to be affected.
Currently I need to publish my app thru ExpoKit to see the latest changes, how would I build my android app so it would not have any reference to Expo but still be able to work properly
Currently this is how I understand how the react native and expo works: first u build ur app using react native code and then a bundle.js is generated somewhere on cloud(EXPO) using publish command so the app communicate with that bundle.js.
Note I am not using any feature from Expo so why would I need Expo in this case?
Edited: If I am detaching my app from expo, I mean why would I still need Expo? Can't I just build the app and run the app without expo at all?
You can build your whole application without using expo, just follow the steps from facebook documentation in "Building Projects with Native Code" tab.
or
you can run "npm run eject" in your project root directory folder.
After this, you can build your appliaction using react-native cli commands, like
react-native run-android.
edited :--
For building apk for production, you can follow steps given in facebook documentation as generating signed apk and for released IPA for iOS yo can follow building your app for production for IOS.