While I'm trying to install Realm, I'm asked to edit some of the generated .java files for Android:
https://realm.io/docs/javascript/latest/#getting-help
However, Create React Native App hides the system level code from the user. Does that mean using CRNA is impossible, and I have to switch to straight React Native?
create-react-native-app has its own build scripts that depend on the platform specific code to be modified by Expo.
The whole idea of create-react-native-app is to stick to js. By sticking to js, you can take advantage of some pretty neat features such as running your app through the Expo Client or live developing on the web. They can do this because they can serve their static (I think it's pretty static) platform specific code everywhere.
This means you can't use any native code or even third party native code modules (such as react-native-camera) while using create-react-native-app.
From the docs:
Standard Expo projects don’t support custom native code, including
third-party libraries which require custom native components. In an
Expo project, you only write pure JS. Expo is designed this way on
purpose and we think it’s better this way.
If you would like to use native code and create-react-native-app, expo has a detach process that will reveal the platform specific code. You can check it out here.
Related
So, as ýou may assume I want to build an android app. I was contemplating whether to use Kotlin or React Native code, then I saw you can make a bridge with Kotlin and RN. What is the purpose of doing that if simply making a Kotlin/RN app easier to set up?
You will possibly get a few reasons. But a summary of it is the fact that React Native may not have all the functionality you may require to build a certain type of app.
For example, you may want an app that scans the network for a specific SSID or maybe create your own network configuration profile - within React Native, that may be impossible as of now.
But by building a bridge with native code, you can create this functionality natively, and by having a bridge - you can invoke those functions via React Native.
There may be some features that are not implemented yet in React
Native or some device-specific features that are not supported by this
development platform. So we can use native modules to fill the gap.
Why do we need native modules in React Native apps?
Who can really say! Maybe you want to make platform-specific code or
want to reuse some existing code. For whatever the reason, React
Native allows you to create your own native modules and expose them to
JavaScript. The whole process is described in depth in the Native
Modules Android documentation.
Ref: https://proandroiddev.com/react-native-bridge-with-kotlin-b2afde2f70b
It's common to run into situations where we need a third party library that uses native code. Examples: PayPal integration, access to the wireless system, etc.
The official answer for this is "you have to eject". Alright, everybody knows that I know that - no need to reply with this, please.
But there are expo packages that use native code. For example, the react-native-appearance.
So it is possible to create expo libraries that use native ios/android code. But I wonder how? I found no documentation about it. It seems to me that only the Expo core team knows about it because I only see this being used on packages developed by the Expo core team. Maybe I am not looking it right, but I found none, zero information on how packages like react-native-appearance are made.
Question:
How to create an expo package that contains native ios/android code (like react-native-appearance)?
Expo packages a whole bunch of Native Modules with the SDK, including react-native-appearance. If the Native code is included in the SDK, then you can use it, otherwise you might have to eject. Case-in-point, a hello-word expo app is much larger in size that a bare React-native-init hello-world app.
The goal: develop a cross-platform design system to import it in any platform (React, React Native, Android, iOS).
What we got working: a project, developed in React Native, where some core UI components were develop, to ensure the visuals are consistent among all other projects. This project is imported as a dependency in another React Native app that uses these components successfully. So far so good.
Where we got stuck: we wanted to import the same project in native projects (Android and iOS), and use it as custom widgets to build the native UI.
Knowledge acquired from googling:
This article shows that it is possible to build native components in Java/Swift and use them in a React Native Project. We would like to do the other way around.
There is a SDK called Diez that works as a transpiler, from Typescript to virtually any language. It is in early access and we wouldn't like to depends on a SDK.
tl;dr; Is it possible to build a React Native project that serves as a UI component library (i.e. design system) and import it in native Android/iOS projects?
No native project that isn't actively working on going to RN is going to include a react native view- you're adding tons of memory to load a javascript interpreter and seconds of startup time to start react native for that one view. And passing data to RN from native is painful (calling native from RN is not, but the reverse path more or less doesn't exist). If you're going to try to embed RN (and I don't suggest it, pick either pure native or pure RN), it needs to be an isolated piece that doesn't need interaction from the native code.
I am new in react native. when i create react native app by :create-react-native-app My project name the project will create with some thing named Expo in it directory.
then when i run it in emulator it will running by expo and i having to see an app named Expo and i have to run my app by using that. Ok?
i did many search a bout Expo and saw that site, and many other sites and notes which were about Expo but i understood nothing, just Expo will make it Easy to run your app.
now i want to ask: if i use expo; will my clients have to use that for running my app on their devices??
and ask: will i have to pay money for some essential things in future ?(Given that i never want to pay any thing )
will Expo make my application depending on himself(Expo) and prevent me to use various APIs like google map or ?
and in last: using that or not? which way is more professional?
Firstly, welcome to the React Native community!
Most of these questions can be answered in the Expo FAQ
if i use expo; will my clients have to use that for running my app on their devices??
You can at any time detach your app from expo and publish it to the App Store or Android Play Store.
will i have to pay money for some essential things in future ?(Given that i never want to pay any thing )
From the expo FAQ page: "Expo is free.
Our plan is to keep it this way indefinitely.
Expo is also open source, so you don’t have to trust us to stick to that plan.
We might eventually charge money for services built on top of Expo or for some kind of premium level of support and consulting."
will Expo make my application depending on himself(Expo) and prevent me to use various APIs like google map or ?
Assuming you are talking about Native Modules.
Expo provides a very large API for building a native app.
Some known reasons you might detach are:
Using a companies Proprietary internal native API
Unsupported libraries like React Native Fetch Blob - this is currently being added to React Native but until then it is not available in Expo
If you do need to add custom Native Modules, you could always detach from expo. When you Detach you will get an ios, and a android project.
Lastly you could always recommend new features: https://expo.canny.io/feature-requests
and in last: using that or not? which way is more professional?
Using Expo will provide you with tested Native Modules on top of React Native, if anything this makes it more professional.
Here are some popular apps constructed with React Native.
I'm considering writing a mobile app using both Go's mobile lib https://godoc.org/golang.org/x/mobile (I know it's experimental, so this is more of a wait and see situation) for a data layer and a polyfill for the android view and use React-native http://facebook.github.io/react-native/ for the iOS view and hopefully the android view once that is supported (if it is/will be supported).
How much conflict would I have in doing this, if any? I assume I could pass data between the two libraries from each respective native (as in obj-c and java, I know this all compiles to a native app) languages.
To Clarify
Go's mobile lib and react-native would both be compiled into the mobile client. The go lib makes requests to a server and is not the server.
UPDATE
So React Native came out for Android, so now I'm just wondering how go mobile and react native and communicate between each other within the same app executable.
Yes, you can do that. You may include the generated code in your react native project and write some "glue code" (an objective-c and java class) that requires your go library and uses the Native Module extension by React Native to get access to the provided functionality.
I believe that React Native can be used to make mobile apps with any language that can run on the web. Currently I am learning how to make React app with a Golang backend. Later I will build this in React Native and start building other apps with Golang to see how far this goes. There is a course on udemy that teaches golang and react and it isn't that long.