Can we integrate Android Screens with React Native? - android

I am developing an application using react.i designed UI screens for my app using android studio. My question is can i use this screens in my React-native app? is there any possibility that using android screens as UI and coding part for my application using ReactNative?

You can use React-Natvie along with native Android code in same project. But for your use, the simple answer is no. You can't use Android XML layout with React-native, because Android leverages the lucid nature of XML to develop view layouts, while React Native uses JSX, a coupler of business logic and UI.

Related

Project structure of react-native application

I am starting working over react-native for development of android application. I am quite familiar with android studio structure. In android sdk to create view XML is present and for controller java is present. But in react-native how to create view and controller for android application ?
But in react-native how to create view and controller for android application ?
This question is like given an apple but analyze as an orange.
For react-native, exactly for React part, we don't explicitly manage it as view and controller as we did for android or ios.
I suggest you read about React first. It is the core idea. The Native part is just meaning build the native mobile app by React way (you have totally 100% ways to touch the native part - android/ios code - without any restriction as you want).

Use react native to create a iOS framework and Android library (not app) from common code base

Has anyone had any success using react native to create both iOS and Android apps that can be used as libraries/sub-projects in other iOS and Android native projects that were created without react native? My goal is to create new functionality for an existing app that has both a iOS and Android codebase that was developed without react native.
As a simple example, lets image that I need to create a series of screens and logic to allow a user to 'create a new account'. Ideally I would like to create the new functionality (controller, views, api-client, etc.) using react native and then export it as a self contained iOS and Android app. In addition to being able to run these apps on their own, I would also like to be able to include them in other native iOS/Android projects as sub-projects. The native iOS project would then create a new storyboard/ViewController/segue(s) and link the main-view of the react native iOS App to it.
I know on iOS/xcode I can add a sub-project by drag-and-dropping an .xcodepro into another one. If I did this with a .xcodepro that was created with react native, how would I go about linking the top level view to the existing non-react native iOS project? Is there a similar process on the Android side to achieve the same functionality?
I would like to explore React Native as well. We have similar needs as you - to develop a common library/framework for iOS and Android. Our solution was to code the library in C++ and use it in XCode on iOS and through a JNI (Java Native Interface) converter on Android as well. The JNI is a pain as not everything translates 1 to 1. I researched using Ruby/RubyMotion but that also has a JNI conversion step. There are other languages that do not require a JNI conversion - but from my last read these are also eperimental. Trying all of these will require effort and results are not guaranteed. Assuming aside from the shared library you still want Native for the rest of the App (UI etc), this will require developers with a combination of Swift, React, and Java (which could get expensive) The approach that makes most sense would be to use Swift for the iOS framework and Kotlin for the Android library and use the same style (functional/react-swift/react-java style code) That way, while the libraries are still different, they are coded in the same style so development/maintenance effort on one can be quickly copied/applied to the other.

React native web-view vs Cordova

I have an app build using cordova. However, making it look properly on android is being a bit though. I read reac-native documentation and I thought about combining the current state of the app, embedding it on a web view and building the rest of the app using react-native.
The reason behind this is that I feel more comfortable building the android specific ui of the app (like sidebars, and menus) using react-native than cordova, and I want to know if this approach makes sense. Is react native web view as powerful as cordova? Does this make any sense?
Thanks and regards
Despite React Native owns a WebView component I believe that this component is not appropriate for your approach.
From the docs:
WebView renders web content in a native view. You can use this
component to navigate back and forth in the web view's history and
configure various properties for the web content.
The purpose of React Native WebView is simply "renders web content".
I believe that you can not simply put your current Cordova code inside a React Native Web View and "it works". If your current Cordova app is more than simple HTML pages and use some Cordova Plugin, for example, you will have problems at this point.
Added to this the fact that strange architecture will probably increase the maintenance cost.
And about React Native to be as powerful as Cordova: I would say that React Native is more promising and very powerful, but actually Cordova has a ecosystem more mature and consistent. Maybe you should take a look at NativeScript.
Is react native web view as powerful as Cordova?
Answer: It's more powerful than Cordova
Unlike Cordova/PhoneGap your code runs in a JS runtime on the OS, but the UI is rendered as native components. This makes it very different than Cordova/PhoneGap.
You can use the standard platform components such as UITabBar on iOS and Drawer on Android. This gives your app a consistent look and feel with the rest of the platform ecosystem, and keeps the quality bar high. These components are easily incorporated into your app using their React component counterparts, such as TabBarIOS and DrawerLayoutAndroid.
As for Cordova, you're bound to the limitations of the WebView.And since JavaScript is single threaded, you will at one point run into issues if there are too many things going on in your application code. Such as sluggish animations etc...

Phonegap with Android XML

I'm working on a android application
I would like to create a application for android using phone gap.
Is this possible? can I create a front end design in Android XML and back end controller functions in phonegap and make it an app in android studio ?
Any thoughts / experiences?
YOu can use cordova/phone gap to develop mobile apps. But these framework uses HTML5/css/JS technologies to do so. Sn android.xml would not work. You need to create your UI using HTML+CSS and code your business lodic in JS.

Does Android Studio supports AngularJS for Android UI design?

I have a question about Android Studio: Does AS supports AngularJS code while designing XML files, e.g. for small animations or effects?
SUMMARY : NO
There is no way you can write Angular JS code while developing Android Native app. You can use Angular in a WebView (using js/html so), that's all.
AngularJS is a completely different technology than what is used in native Android apps. Native Android apps use Java and/or C for their code, which is compiled when you build the app. AngularJS is a framework for web development, running specifically on Javascript (a completely different technology than Java).
You can build apps without using native Java or C code, but there are tradeoffs. As noted in other answers, you can display webpage views as apps (using technologies like Cordova]), or use frameworks like React Native to write code in Javascript that then gets compiled to a native app. You could use AngluarJS in the webview instance, since it just displays a webpage, however not in something like React Native. I highly encourage you to check both of these (and other options) out, but keep in mind that they have their own limitations and tradeoffs – no one way is the "right" way to build an app.
In summary: No, AngularJS is a web technology, not a native app technology.
new answer = Yes... Sort of, you can do it with:
https://www.nativescript.org/
It translates javascript, angular and typescript code into native components!
Apparantly it's possible to use nativescript in Android Studio with:
https://docs.nativescript.org/runtimes/android/getting-started/hello-world
Android Does not support AngularJs. but still if you want to use you can use it in webview.

Categories

Resources