Is there any advantage of using Expo or CRNA when must have to eject? - react-native

I have developed only by native CLI since I started RN, but I have become interested in CRNA or Expo recently.
But if I want to use a library which expo does not support, I heard I have to do a eject.
I often make mobile apps for IoT products, so I think I should use Bluetooth or Wi-Fi library, so I think I should use a library that is not supported by expo unconditionally.
In such an environment where an unconditional eject must be made, does using expo or crna have advantages over using the native CLI?

One possible advantage of using Expo even after ejecting is that after ejecting, you can opt to have a native project linked to ExpoKit. ExpoKit is a native library that allows you some of the same conveniences that you would have when using the Expo client.
https://docs.expo.io/versions/latest/guides/expokit.html

Related

What is the difference between Bare and ExpoKit while ejecting React Native Project?

How would you like to eject your app?
Bare: I'd like a bare React Native project.
ExpoKit: I'll create or log in with an Expo account to use React Native and the Expo SDK.
Cancel: I'll continue with my current project structure.
What is the difference between ExpoKit and Bare?
What are the advantage and disadvantage on choosing this?
The two ways to use Expo tools are called the "managed" and "bare" workflows.
Managed workflow
Apps are built with the managed workflow using the expo-cli, the Expo client on your mobile device, and expo various services: push notifications, the build service, and over-the-air (OTA) updates. Expo tries to manage as much of the complexity of building apps for you as they can.
Bare workflow
This is workflow where you use some of the Expo tools in a vanilla React Native app. Unlike in the managed workflow where you don't touch the underlying native code directly, in this workflow the developer has complete control, along with the complexity that comes with that.
ExpoKit
ExpoKit is another way to use Expo tools in a vanilla React Native app. The problem with ExpoKit is it is, compared to the "bare workflow", very monolithic — you essentially include the entire runtime from the Expo "managed workflow" in your app, rather than only the pieces of it that you want

ReactNative, What's the benefit of using expo bare workflow?

There was create-react-native-app just like create-react-app
However I see https://github.com/react-community/create-react-native-app has been merged to expo.
Since I need native (android or ios) support, I can do either of theses
expo bare workflow
https://docs.expo.io/versions/v34.0.0/bare/exploring-bare-workflow/
react native init
https://facebook.github.io/react-native/docs/getting-started (react native cli quickstart)
What do I gain by going through expo bare workflow?
If you use Expo, you can use the module in Expo. Of course, Expo needs to install modules for APK availability starting with SDK33. However, you do not need to link the Expo separately.
If you use Expo, it will automatically reload the code when it is refreshed and not restarted, making it easy to see the code change.
And with fast feedback, the development cycle will be faster. Because the process of communicating from simulator to native apps is still slow, build time will be increased when using Web versions that run directly into the browser, until HMR creates a basic framework for the app because it is fast and fully available with Chrome Developer tools.
Also, if you want to install a React-native module that requires a link, you can use the 'expo eject' command to eject Expo. Then you can use React-native.

react-native message queue using expo

I'm developing a mobile app which needs to produce and consume message over a message broker using react-native. As far as I search I could find just few libraries. One of them is react-native-rabbitmq but its using native modules which is not supported by Expo. My question is what is the best way of communicating with a message broker(Kafka, RabbitMQ, MQTT etc.) using Expo.Or I am open for any other solution instead of using message broker. Thank you in advance.
you can use ExpoKit
Ejecting to ExpoKit
ExpoKit is an Objective-C and Java library that allows you to use the Expo platform and your existing Expo project as part of a larger standard native project -- one that you would normally create using Xcode, Android Studio, or react-native init.
If you created an Expo project and you want a way to add custom native modules, this guide will explain how to use ExpoKit for that purpose.
Normally, Expo apps are written in pure JS and never "drop down" to the native iOS or Android layer. This is core to the Expo philosophy and it's part of what makes Expo fast and powerful to use.
However, there are some cases where advanced developers need native capabilities outside of what Expo offers out-of-the-box. The most common situation is when a project requires a specific Native Module which is not supported by React Native Core or the Expo SDK.
In this case, Expo allows you to eject your pure-JS project from the Expo iOS/Android clients, providing you with native projects that can be opened and built with Xcode and Android Studio. Those projects will have dependencies on ExpoKit, so everything you already built will keep working as it did before.
We call this "ejecting" because you still depend on the Expo SDK, but your project no longer lives inside the standard Expo client. You control the native projects, including configuring and building them yourself.
this link is about Expokit

Difference between ExpoKit and React Native project

I did a lot of research now to find out the exact differences and trade-offs between a React Native project, CRNA and an Expo project.
My main guidance was this
However I still don't understand what (dis-)advantages I have using ExpoKit with native code vs. a normal React Native project with native code, apart from the fact that I can't use Expo APIs in a normal React Native project.
I know that when I start a project in Expo I can eject it either as ExpoKit project or as React Native project.
In both I can use native code. In ExpoKit I can still use the Expo APIs in a normal React Native project I can't.
So my questions:
What would be my interest to use a react native project if I can use native code and all Expo APIs in an ExpoKit project? In an ExpoKit project I can still use all Expo APIs and all React Native APIs, right?!
Could I use Expo APIs in a React Native project if I install expo with npm install --save expo?
What is the difference between React Native API and Expo API?
ExpoKit is kind of a hybrid between "pure JS" Expo apps and "vanilla" React Native. At its core it's still a React Native project, but a few things differ about the build system, developer experience, and features available.
Features
As of today, most of the APIs in Expo's SDK are not available in a vanilla React Native project, but they are available in ExpoKit. We think this might change in the future, but it'll be a lot of work.
Expo's push notification service does not currently work in ExpoKit, nor for vanilla React Native.
Build System
Both vanilla RN apps and ExpoKit apps use Xcode and Android Studio to build the native code. iOS ExpoKit apps use CocoaPods to install dependencies, which can add a little bit of complexity to managing the native build. Android ExpoKit apps have additional Gradle configuration to build multiple versions of React Native into the same binary (this is used to enable over-the-air updates of multiple SDK versions of JS), which can sometimes increase the complexity of adding other React Native libraries.
The JavaScript for an ExpoKit and React Native project is built by Metro, although in ExpoKit you need to run Metro using Expo's XDE or exp tools so that they can handle extra configuration for the project. This means you run a command like exp start rather than react-native run-android.
Due to the current design of ExpoKit (although this may change in the future), some open source React Native libraries may have compatibility issues with ExpoKit. For example, if a native library expects to be able to request a reference to React Native's OkHttp instance on Android, there may be a type mismatch when running inside ExpoKit due to the namespacing Expo uses to allow multiple versions of React Native to compile. That said, these issues tend to be pretty rare, and we're working on a few different ways for ExpoKit to be more and more compatible with libraries in the ecosystem.
This multi-version support also means that ExpoKit binaries tend to be larger than corresponding vanilla React Native binaries, although that may change in the future.
Your subquestions
Some developers prefer to manage how their JS bundles and assets are distributed themselves, or they may need a library which isn't currently compatible with ExpoKit. Binary size is another reason why you may prefer vanilla RN.
It's not currently possible to use most Expo APIs in a React Native project. Some APIs available in the Expo SDK are bundled from open source projects (such as react-native-maps) and can be used with a vanilla RN project.
I'm not sure how to parse this question -- Expo APIs are currently just React Native APIs which know how to talk to each other and make certain assumptions about the environment they're running in.
Question from comment 1: You can modify the ExpoKit build all you want, although it may make it slightly harder to upgrade to a newer SDK release depending on how heavily you edit it.
Note to anyone who stumbles across this after 2020 ... ExpoKit has been deprecated so this whole question is moot.
From Expo's documentation: "ExpoKit is deprecated and support for ExpoKit will be removed after SDK 38. We recommend ejecting to the bare workflow instead."

How do I know if a third party library will work with Expo?

Expo is great. One of it's goals is to use only javascript to write React Native apps.
How do you determine if a third party React Native library will work in the Expo development environment?
The simplest approach is to look at the install instructions of the library.
If react-native link is mentioned then it won't work with Expo.
You can run any library by Detaching to ExpoKit but you will lose some of the benefits of using Expo in the first place.