integrating react native app in my kmm project - android

i read multiple articles talking about being able to somehow embed a react native application into a ios / android native application. However it is always the other way around, which means that it's describing how to have native modules inside the react native application. In this case i wanted to embed Rocket.Chat into my kotlin multiplatform mobile project which i have been building for quite some time now but if i understand it correctly, i would have to make my project part of the rocket.chat application. Is there an option / instruction where i could not do it this way and simply embed the chat into my project?
i was expecting to embed rocket.chat, which is a react native mobile application, into my KMM project to use it as a chat. However i find no option to call / start rocket.chat (which can also be whitelabeled).

It is possible to embed a React Native app into a native iOS or Android app, but it is not a straightforward process. One approach would be to use a "WebView" component in your native app, which allows you to load and display web content within your app.
You can use the WebView as a container for your Rocket.Chat React Native app. This way, you can load the Rocket.Chat app in the WebView, and it will appear as if it's part of your native app.
You may also use the react-native-webview package to load the Rocket.Chat app in the WebView.
Keep in mind that this approach may have some limitations, such as the Rocket.Chat app not having full access to the native features of the device, and the performance may not be optimal.

Related

What is the purpose of bridging Kotlin and React Native?

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

Can I use react on android? (not react native)

This might be a naive question but I want to know if it's possible to run react on android devices?
I'm new to react - I only know the basics of it. I know that react-native does not use html but native-ish objects as markup.
I just want to create a really simple app which I want to be able to access per browser but also as app.
So yeah. It's kinda hard to google this question beacuse you'll get flooded with react-native answers. Or well - maybe I just haven't tried hard enough.
Yes, although this should not be considered good practice.
You can create an app that shows a WebView where you load your react code from the local file system. See also adding ReactJS in android Webview
Yeah absolutely you can run react on an Android device!
A very common way that mobile apps implement this (outside of React Native), is to have the app open a WebView – which just opens a view of a website (running React).
These apps are slower than native-ly written apps or React Native, because there's an extra layer of translation. They are typically the simplest version of an app – all they do is open the WebView and let a responsive web app take over from there.
There's even a few tools to compile a single set of source code into apps for multiple operating systems (Android and iOS at once).
Cordova and Electron(desktop) are a few popular options.

Installing Realm with Create React Native App

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.

Embedding React or React Native to an existing mobile app

I have been doing research about usability scenarios of React and React Native to ultimately decide whether it is a feasible and responsible decision to embed React (or React Native) to an existing mobile app.
So far, what I have learned is that it is possible to render React Native code within a custom view in both Android and iOS. Embedding React is simpler, since a React app is literally a web page that loads the client side framework.
My concerns are many and may also be pointless if I misinterpreted some scenarios. Below are the ones for which my Google skills failed me to get some answers.
Is it possible to use a third party's React component in a React Native rendering view?
What do I lose in terms of backward compatibility and UI performance to fully utilize React Native in mobile? Do low-end devices handle it well?
Is debugging React and React Native a pain? This question may and should be responded subjectively.
When I use React Native, is it possible to push updates to my app's that specific part without publishing an update to Google Play or Apple App Store?
Is React or React Native incompatible with CoffeeScript on the server side? If so, can I avoid that with a custom build flow to ultimately end up with only Javascript files which contain all the server code?
Sorry for the long entry.
Thank you
I worked for react native for several months,and here is my answer:
Is it possible to use a third party's React component in a React Native rendering view?
No,react component for Browser cannot use for mobile.but there are many mobile specific component.You can find here:React.parts
What do I lose in terms of backward compatibility and UI performance to fully utilize React Native in mobile? Do low-end devices handle it well?
You can test these apps on low-end devices to see whether react native can meet your need.
Is debugging React and React Native a pain? This question may and should be responded subjectively.
No,debug React Native code is really easy and efficient.
When I use React Native, is it possible to push updates to my app's that specific part without publishing an update to Google Play or Apple App Store?
Yes,you can do these things easily with Code Push.
Is React or React Native incompatible with CoffeeScript on the server side? If so, can I avoid that with a custom build flow to ultimately end up with only Javascript files which contain all the server code?
There isn't server side code in React Native,all your js code is in a single js file called bundle.js. the compile process is automatic with packager.sh witch provided from React Native,check this link.

Can Golang mobile be used 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.

Categories

Resources