Files
react-native/docs/JavaScriptEnvironment.md

2.8 KiB

id, title, layout, category, permalink, next
id title layout category permalink next
javascript-environment JavaScript Environment docs Guides docs/javascript-environment.html activityindicatorios

JavaScript Runtime

When using React Native, you're going to be running your JavaScript code in two environments:

  • In the simulator and on the phone: JavaScriptCore which is the JavaScript engine that powers Safari and web views. Due to the absence of writable executable memory in iOS apps, it doesn't run with JIT.
  • When using Chrome debugging, it runs all the JavaScript code within Chrome itself and communicates with Objective-C via WebSocket. So you are using V8.

While both environments are very similar, you may end up hitting some inconsistencies. We're likely going to experiment with other JS engines in the future, so it's best to avoid relying on specifics of any runtime.

JavaScript Syntax Transformers

Syntax transformers make code writing more enjoyable by enabling proposed-but-non-standard javascript syntax.

As of version 0.5.0, React Native ships with the Babel javascript compiler. Check Babel documentation on its supported transformations for more details.

Here's a full list of React Native's enabled transformations.

ES5

  • Reserved Words: promise.catch(function() { });

ES6

ES7