Read this beautiful material Intro to React Native for an iOS Developer. Why you should? React Native makes it feasible to share a lot of code between iOS, Android and Web. It is not a panacea for making a cross-platform app though but we will point some main reasons why React Native for iOS developers can be considered as one of the options.
The scope of the original 45-minutes-to-read article is here.
To make a developer experience as fast as the web developer’s you need to really reflect on how slow native development is. A change in one part of the app requires a full restart of the simulator, and for the developer to get back into the same position to see the changes. As a web developer you would just refresh the browser. For example with the simplest Xcode iOS app template. Even 9 seconds per change leaves a lot of time to lose focus, and discourages playfulness.
React was built for the web – but some people realized that they could de-couple the React component tree from the HTML output, and instead that could be a tree of UIView’s. That is the core idea of React Native. Bridge the React component tree to native primitives. React Native runs on a lot of platforms:
- Officially: iOS, Android, tvOS & VR
- Unofficially: macOS, Windows & Ubuntu
Each of these platforms will have their own way of showing some text e.g.
- RCTText for iOS and tvOS – which uses NSTextStorage, and drawRect
- Textfield for Android – which uses Canvas and a DrawCommand
- Three.js view primitive for VR – which uses BitmapFontGeometry + Shaders
- RCTText for macOS which also uses NSTextStorage, and drawRect
- ReactTextShadowNode for Windows – which uses a RichTextBlock
- QQuickItem for Ubuntu – Which uses QString to render
But when working at React-level, you would use the component Text. This means you work at a “React in JS” level, and rely on the primitives provided by each implementation of React Native.
Like any cross-platform abstraction, React Native can be leaky. To write a cross-platform app that purely lives inside JS Runtime, you have to write React-only code. React and React Native doesn’t have ways to handle primitives like UINavigationController – they want your entire app to be represented as a series of components that can be mapped across many platforms.
Author says if you’re considering a new app, or a grand re-write React Native should be considered as one of your options. It can help you be cross-platform on mobile, but also cross-platform with the web.
In the original article you will find next information:
- Handling “State” Changes and View Management
- More about core idea of React Native
- Trying out React guide
- JS tooling, testing and deployment
- Doing it right per platform
- Long-term aspects of React Native and performance
- Places where React Native hasn’t fit for us
- When to choose
- Integrating in the existing app
A lot of, huh? But this in-detailed material is worth to spend your time with, believe us.