Talk about the app architecture selection: React native or Hbuilder

Source: Internet
Author: User

Original link

Introduction: Recently the company's new product app to carry out research and development, the boss's intention is to use H5 to do mixed apps to achieve efficient agile development purposes. I naturally began to carry out a variety of technology selection of research, here is the key to say that I finally picked out the 2 hybrid app development Technology solutions: RN (react native), Hbuilder. React native is the famous Facebook open source technology framework, and Hbuilder is the H5 tool development company Dcloud product in China. Let me summarize it myself: these two technical frameworks are basically comparable to the speed of web development in terms of development efficiency, and RN emphasizes that "learn once, Write Anywhere", RN does not demand a native code to support multiple platforms, while Hbuilder can implement Java-like " Write once, run anywhere, which means writing a code to publish multiple platforms at the same time, is more efficient than native development. The principle of the two are based on JS in the front-end development, with JS to do the bridge calls the native API, the biggest advantage is to make the app dynamic update without frequent release version, of course, hybrid this framework also has weaknesses, is the current native app development ecology has become mature, Some third-party libraries and frameworks are not only rich and stable, so if you use the JS-based hybrid app solution, be sure to consider whether app products are suitable for this technology.

Below I put some netizens ' views on these two frameworks are listed below for reference:

Rn-react Native Part —————————————————

React Native Core realization: First simple to say a few points, detailed and so on back to update. 1. React native Inside no webview, this goods is not hybrid app, inside the execution JS is used

JavaScriptCore. 2. Besides the core of react Native, IOS Native Code provides 10 of the most basic core classes (Rctdeviceeventemitter, rctrenderingperf, etc.), or components (Rctview, Rcttextfield, Rcttextview, Rctmodalfullscreenview, etc.), and then the JS portion of the react native, composed of 20 basic components (Popover, ListView, etc.), To be used by business parties on the upper level (Thgroupview). 3. As they say in the propaganda, they have implemented a set of CSS-like subsets to solve style problems, which is quite complex and powerful, relying on this ability to make native core components of the JS layer of the basic components of the business side of the business components, should be the use of Facebook/css-layout The C language version of GitHub is implemented (in PPT we see code like Flex-direction:column, which is the syntax supported by Css-layout). 4. In react native, the engineer who writes JS solves the problem of assembling basic components into usable react components, and the engineer who writes native code solves the problem of providing core components that provide sufficient scalability, flexibility, and performance.

What is React native?

In fact, this thing from native development, equivalent to re-invent a browser rendering engine and set a react shell, from the web development point of view, is the original react back end replaced by native code to achieve, and Flipboard recently engaged react Like Canvas: Flipboard Githubreact-canvas
Advantages and disadvantages of React native:

Advantages relative to Hybird app or WebApp:
1. Do not webview, completely out of the webview annoying interaction and performance issues
2. There is strong extensibility, this is because the native side provides the basic control, JS can be freely combined use
3. You can directly use the native native "awesome" animation (in the FB Group app, the panel slide out with a little jelly bounce, the panel based on a point to expand the animation everywhere, this animation with native code to do a piece of cake, but it is difficult to do with the Web).

Advantages relative to the native app:
1. You can update the app directly by updating the remote JS, but this is fast becoming the standard of the large native app ...

Disadvantage:
1. Extensibility is still far less than the web, and it's far less straightforward to write native code (this nonsense explains it)
2. From native to the web, there are many conceptual transformations that will inevitably compromise both sides. For example, the Web to use a set of CSS version of castration, native through Css-layout to get the final style and then converted to native native expression (such as iOS Constraint\origin\center and other properties), such as animation. In addition, if Android and iOS have to do the same package, the concept of conversion is more complicated.

Hbuilder Part ————————————————————-

PhoneGap out of the early, natural use of more people.
PhoneGap own localization is the mixed development hybrid, uses the native +js;
Hbuilder's positioning is pure JS to take care of everything.
5+ and PhoneGap are superior to phonegap in capabilities, performance, and ease of development.

First look at the ability:
5+ has html5+ and native.js technology, html5+ contains hundreds of commonly used cross-platform API, can meet the general development needs, and native.js the 40w native API mapped to JS object, so JS can directly tune the native. The combination of html5+ and native.js form the most powerful engine of power. and phonegap need to use the native engineer to write the original plug-in and to the JS developer package interface to achieve JS tuning native ability, development costs, the requirements of people are not the same.

Of course 5+ also supports native plugins, which is similar to PhoneGap. A native SDK that has been written without the need for native.js rewriting or integration with the 5+ SDK. See document Center –5+ app–5+ SDK

5+ 's direct package cross-platform API comparison full, two-dimensional code, shake, map, share, voice input, push these common APIs are cross-platform, easy to use. See http://www.html5plus.org/

See Performance again:

PhoneGap do the app, on the low-end Android phone is difficult to run smoothly, otherwise HTML5 long ago, the original development has been squeezed. PhoneGap to avoid the poor HTML5 experience, the use of the spa mode, but this mode in fact, the low-end machine can not play, and the code is very complex.
5+ app has a higher performance, its dynamic effect is handled by our enhanced engine, through the enhanced engine, can be smooth on the low-end machine to run a variety of dynamic effects, such as side-by-side menu, drop-down refresh, long list scrolling, see home Page –app tab-Performance video

Finally look at the development of convenience:

PhoneGap no professional development tools, grammar hints, debugging, packaging are very troublesome.
In Hbuilder, 5+ 's syntax API hints are perfect;
The mobile phone through the data cable connected to the computer, Hbuilder can be real machine running, save a page immediately see the effect on the phone, Android can also see Console.log. And with PhoneGap, you change the page, you have to pack it, then install it on the phone, then find the wrong, then change the code, and then continue to pack ...
With regard to packaging, phonegap is provided by Adobe for Cloud packaging, but it needs to prepare resources on the machine before committing to a foreign server, and Hbuilder is a one-click package for more convenience. Of course, both PhoneGap and hbuilder support local packaging, which requires a bit of native development knowledge.

In addition to tools and runtime, there are MUI frames

PhoneGap is just a phone runtime, no Hbuilder tools, no MUI frame.
MUI is the closest to native app HTML5 framework, its experience than JQM, Bootstrap and other frameworks closer to the native, its performance is much higher than JQM, Bootstrap, Ionic, Framework7 and other frameworks.
This performance difference causes 2, on the one hand is the design idea different, Mui insists to use the native JS to do, does not rely on jquery or ANGULARJS, because the framework relies more, the app performance is worse, on the other hand because the MUI invokes the 5+ 's underlying native acceleration, which is faster than the frame without the native acceleration.
MUI See: http://dcloudio.github.io/mui/

Of course PhoneGap has an advantage, is to support Windows Phone, BlackBerry, this aspect 5+ really does not support.

Advantages: Dcloud Other services not specifically used, Hbuilder used, or a very good editor, the overall experience is good, like code hints is very smart, based on eclipse two times development can make this is also very powerful. In particular, the HTML syntax supports browser compatibility very well. There is a front-end framework to write CSS very convenient.
Cons: Hbuilder size is too large, and it has to be networked, the overall experience is an eclipse style, and I recommend using sublime. The main thing is to make the application is the experience of the web, this is really not suitable for the application. It's OK to be a webapp.

Talk about the app architecture selection: React native or Hbuilder

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.