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.
Related
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.
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
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.
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.
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.