قالب وردپرس درنا توس
Home / IOS Development / React native is native

React native is native



React native apps are native apps. It's a fast of a coup they have pulled off and while I have concerns about adopting the technology, is "Is it native?" Is not one of them.

But what is "native"?

I suspect you agree with me on what we understand of "native". Here's what I have in mind:

  • Uses the platform's preferred UI toolkit
  • Wires into the platform's common event delivery mechanisms (touches, keys, moves, placements, etc.)

Total:

I Claim React Native meets that line.

Same Mechanisms Different Marshaled

I have used most of my years to have the same ends as an app developed using the platform's preferred tools. a professional programmer working on Mac and iOS apps. From my Apple original point of view, React Native is a very elaborate way to marchale UIVit mechanisms against the usual UIKITs:

  • View creation and configuration: Many iOS apps rely on XIB files for their creation and configuration of the view. If you have not seen an XIB file on the disk before, take a look: It's your user interface, rendered in XML. Reag Native uses handwritten JSX to clean up their UIViews, but there is a difference more in spell than in form. (The code's something closer to manual view creation and configuration code, but there is also something in vogue among some iOS devs.)
  • Layout: It's not enough to just share some views inside someone else. You sometimes want them to have a certain shape. IOS devs can use fast AutoLayout constraints, or Ye Olde Visual Format Language, or the newer anchor-based API that uses the type system, or Snap or Masonry, or, or … Whatever you use, it eventually boils down to the setting of the view frame. Well, React Native likes to use a flexbox-like to describe its layout. It also boils down to hit updates using Yoga.
  • Event Dispatch: You have your UIViews, you have your IBActions. You encrypt your event response using JavaScript instead of Swift or Objective-C, but eh ̵
    1; what is another C family language?

Language and Context Context

Well, about the other language. Let's talk about animation jank and asynchronism.

What is "jank"? It's jargon for what happens when it's time for something to appear on the screen, but your app can not provide the necessary pixels fast enough to show it. As Shawn Maust left it back in 2015 in "What the Jank?":

"Jank" is some stammer or choppiness that a user experiences when it is
on-screen motion like scrolling, transitions, or animations.

The difference in language stations to something that may seem less than native at first glance. You see, there is a context switch between UIKit country and React Native JavaScript action-trading country, and with a high enough call rate – for example, animation handlers to run at frame rate – time taken in data marshaling and context switching can become noticeable.

Native apps are not immune from animation jank. It feels like it's a WWDC session or three each year on how to not stem when you roll. But overhead in the technical mechanism eats some of your time budget, which means you get sweep less inefficiency in the app code under Moore's rug.

Native apps are also not immune from blocking rendering entirely. Make a bulk import to Core Data on the main thread, analyze an adequate (or malicious) XML or JSON document on the main thread, or run a full network request on the main thread, and the system watchdog will kill the app while leaving a "8badf00d" death mark. React Native's context switch automatically enforces the best practice of working the main thread: React Native developers naturally fall into the "pit of success" when it comes to aggressively squeezing headache.

Asynchrony

How do you take away the time taken by a call? You do less work or you work on the other side of the bridge.

Or you surrender this gap, like asynchronism, in your programming model with:

  • Reversals
  • Delegates
  • Operations
  • Operations
  • Reactors (Run-Loop Observers)
  • Promises Futures Results Observables Streams Channels

Apple's framework conditions are flourished with these mechanisms. The regular IBAction-to-URLSession-to-Spinner-to-view update stream has a slow HTTP call in the dog in the middle. The React Native's IBAction-to-JSCore-to-view update flow has a small, small RPC bridge in the middle that often goes fast enough to let you pretend it's synchronous. By the end of 2018 you can not even pretend – React Native will directly support synced cross-talk conversations where it's beneficial.

React native programs with their action traders in JavaScript is no less original than an iOS app with action traders on a server on the other side of an HTTP API.

If you've worked with the usual "all the brains are in our server-side API", it should be heard twice if the server API happens to be implemented in Node.js.

And in fact, the same language runs both server side and client side making it much easier to change which side of the tube an operation is happening to. (Such is the enjoyment of isomorphic code, and there is one reason why someone is excited about Swift on the server.)

Native is as native

React Native uses the same underlying mechanisms and benefits so much from Apple's work on UIKit doing any other iOS app. Ready Native apps are native – maybe even more native than many "iOS app as Web API frontend" apps!


Source link