react-native init versus Expo for new React Native project? - android

I am completely new to React Native and I would like to develop my first RN app. I have experience with React and building iOS apps with Swift, but I have never tried React Native.
I see that there are two main ways of creating a new app, either with react-native init or through Expo. Which is the preferred toolchain for someone of my experience? Can somebody explain the tradeoffs between the two?

If you are just trying to learn, I would suggest you to use the cli.
The main difference between react-native init and expo is that you cant add native modules and can't use packages with native language that require linking. Overall if you are creating a small project that doesn't require functionalities that the cli, go for expo. But if you are builidng a decently large project or if you are just trying to learn your ways around react native, I would chose the cli. IMHO

Related

Is there a way to use ReactNative library in Android/iOS?

I worked on a React Native library and we build some native functionality like implementing BLE. So we did that in Android and iOS folders under React Native. Now we want to use the same functionality in Native project iOS and Android (Native). Reason we built in React Native is coz we have a different project thats in React Native. But now we are trying to use this library in native projects. We are not sure how we can achieve that.
We don't have anything built in this Library other than in Android and iOS folders under RN project.
Attaching image of how we build or functionality in React Native but under Android and iOS folders. (We can just copy pate and create a native library but trying to avoid that).
I don't think so. you probably have to separate them to 2 different libraries and publish them independently

How to build my react native app with TeamCity?

I start using Team City and my app builds with react native version 0.60.5...
I was wondering what will be the best and the easier way to build my app for iOS and android.
For iOS I was thinking using the Xcode plug.
For android I'm thinking to use Docker but its complicated and taking time to develop..
Does someone has any recommendation what to use for building my android app or Docker is a good solution?
And about the iOS, are you recommend use the Xcode plug or any other idea?
Thank you for the help
You can easily use TeamCity to automatize your build for Android, check the official documentation for more information:
You just need to be careful specifying the requirements for build your project for React Native, like:
version of react native, version of expo-cli, version of node that you are using in your project and etc...
For IOS, i recommend using fastlane, check this official tutorial from Apple.
Don't forget that you need to have an developer account for build to ios in React-Native.

React Native Eject but still being able to use React Native code

I've built some little prototypes within Expo with React Native but now I'm in the middle of a real project and I'm now discovering I will definitely need to eject my project for certain components to work.
My question is, once I eject, can I ever write React Native Code without having to init again which I assume will erase any changes I made at the native level?
Any techniques or references are appreciated.
Your question is a bit confusing, so I'll try to answer it as best as I can.
TL;DR: You will be able to write React Native code once you eject from Expo without having to use expo-cli init.
Expo Init
When you say "...can I ever write React Native Code without having to init again..." I assume you mean exp init (or expo-cli init) as opposed to react-native init. These commands merely initialize the project for you, so you shouldn't need to run them more than once.
For more information about how they differ from one another I recommend this GitHub issue thread.
Expo Eject
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.
This means that when you eject your app you'll be writing React Native code outside of the Expo client environment, meaning you'll have access to the native code for Android and iOS. Even so, you will write normal React Native code (Javascript and JSX).
Also once you eject, Expo will add Expo Kit to your project which will give you access to some of Expo's features. For more information check their docs.

How are React Native modules different from Cordova plugins?

I was looking into comparison between Cordova based hybrid apps vs React Native and was confused how are React Native modules different from Cordova plugins?
(in case both are same, then why is FB reinventing the wheel)
Does React Native modules support all devices feature like Cordova does?
Thanks,
Rohit
How are React Native modules different from Cordova plugins?
React Native Modules and Cordova Plugins both perform the same task: they allow the calling framework (React Native or Cordova) to invoke specific native functionality which is not available by default in the framework.
As such, the native functionality provided by a React Native module may be the same as provided by a Cordova plugin, but they will have a different interface to the framework which sits above.
Therefore, it's possible to factorise out the common native code and have a native component which is made available as both a React Native module and a Cordova plugin.
For example react-native-background-geolocation vs cordova-background-geolocation.
Since only the interface to the native functionality differs, there have been some attempts to write a bridge to allow Cordova plugins to be used as modules in React Native, for example react-native-cordova.
The main difference is that Cordova uses HTML5 + CSS + JS for building hybrid apps. Your app will still run inside of webview. Although I've never worked with it, I can comment something
What does it mean?
I'm not sure about support of important features, like bluetooth, graphics, images (Core Graphics, Core Image), other core features
Performance also won't be the same as native app
React Native is different here, because all it does - translates your JS code into native code for platforms. The performance still can't be the same, but it's comparatively high.
Also, you can use native modules for your application in case you can't find one already created by others, so every feature accessible under platforms still be reached from React Native

Can I build Android apps with react native?

The recently launched react native features just iOS app example and docs.
Yes.
React Native for Android was released September 14th, 2015.
Docs: http://facebook.github.io/react-native/
No. You can't build Android apps with this release.
Facebook has indicated that they are working on an Android version, and famously said "give us 6 months", which some people have taken as a promise. I wouldn't base any important business decisions on the illusion that it will be unveiled when the 6 months is over, but you can at least take some hope in the fact that they're serious about making it production-ready before they give us access to it, and that it's not just a pie-in-the-sky hope.
Also, as others have pointed out, Facebook has already release apps that they've built with the Android version of React Native. So at least parts of it are ready for prime time.
UPDATE
Early support for React Native for Android has been pushed to GitHub!
As noted, there are several things that are currently not working if trying to port an application from iOS. But it's worth checking out.
https://github.com/facebook/react-native/commit/42eb5464fd8a65ed84b799de5d4dc225349449be
It is not aiming to be a cross platform, write-once run-anywhere, tool. It is aiming to be learn-once write-anywhere. -Colin Eberhardt, from Raywenderlich
Good news is that React Native for Android is finally here. (https://code.facebook.com/posts/1189117404435352)
while you can't do it right now, it shouldn't take that long.
The first React Native Android App has been published about two weeks ago in the play store as tweeted by the reactjs twitter account:
https://twitter.com/reactjs/status/615638361328349185
Great news! Now its possible!
"And so it happens, the commit we're waiting since about 6 months!" - usereact.com
Please read more on: http://www.reactnative.com/react-native-for-android/
Watch this video: https://www.youtube.com/watch?v=MNNR01NF290
I've tried out Facebook react native on Android and it really worked.
Simple Ubuntu install guide can be found here
Simple js files: link
Yes , We can now developed android apps too in react-native.
and some of the apps are already developed in react-native for android
suchs as:
1)F8
2)Facebook ads manager
3)Squad
4)Discovery VR
5)Ziliun etc..
and many more still counting.
Developers from around the world now opting react-native for mobile app development because of easy of use of JSX syntax.
and also it is commonly noted as simply the V in MVC.
Since React makes no assumptions about the rest of your technology stack, it's easily embeddable within an existing non-React Native app.
TLDR; Yes,
Detailed answer (As of November 2017)
React Native android application development is very stable and a good number of Android applications have been already built and used in production using React-Native.
You can find a showcase of applications here. Most of them have both IOS and Android versions.
You can also easily integrate your native Android java code to react-native. Refer here
As a developer who is building Android app using react-native with a lot of native java code dependencies, react-native runs stable and I found the documentation and community support is adequate.
Yes, it works for both the platforms ios and android, be sure to mention code entry points in app.js if it uses different code for different platforms. However native functions like native events or location manager need to be coded in native languages and then exported using RCT_EXPORT, you can find more about it in the docs
Sure,
Using React Native you can build real mobile app. real app means close to platform or simply can say 99% native app.react native provide easy way for building native android app using javascript for lucrative design.You have basic knowledge of android studio and error fixing in android studio related native module integration and good understanding of react.js then you can build android app using react native.
Basic Requirement for android app
1. Configure android studio please follow below link and avoid installation of python.
https://facebook.github.io/react-native/docs/getting-started .
2. for UI you will learn flex-box from official documentation.
I thing that is enough
Yes, not just with android but also with iOS using XCode
Yes, you can make real-world mob application with React-Native. React-Native is used to create a hybrid mobile application. In this, we write code in javascript which gets converted to swift for ios and java for android.
Yes, You can build the Android app using React Native. For this, you have to install Android Studio with all the required SDKs. You can run your React Native app in Android simulator by using Android Studio and command line both.
For command line, run the following command:
react-native run-android
Otherwise you can open the android project in Android Studio which is created by React Native in android folder and run the project from there.
Happy Coding.. :)
Yes, you can definitely build android apps using react-native.This is one of the great benefits of React Native. Before Facebook created it, you had to build your app twice and with different code : one for iOS using Swift or Objective-C and one for Android using Java or Kotlin.

Categories

Resources