2. Who am I?
● Google Certified Associate Android Developer.
● Founding Member, Lead Full Stack and
Embedded Firmware Engineer @ AutoNxt
Automation.
● Tech Speaker at Google Dev Fest 2017.
● Recognized Developer and Contributor @ XDA
Developers
● Open source enthusiast, contributor and Tech
Speaker.
5. Pros
● Best performance, easy access to HW
and sensors.
● Wide range of resources and Tutorials.
● Large repository of supported libraries
and SDKs.
● Acceptance to App store or Play store
without haste.
Source: medium.com
6. Cons
● Handling different codebase.
● Support for different OS
● Support for wide range of devices.
● UI/UX and different terminologies.
● High development cost due to
multiple resources involved.
Source: medium.com
7. Why React Native?
● Single codebase across.
● Javascript at the heart.
● Near native performance.
● Hot Reloading.
● Access to platform specific code.
● Large community and support for widely
used modules (maps, firebase, etc.) Source: medium.com
8. Quick Comparison
● Java or Kotlin or Swift or C#
● XML, Storyboard, etc.
● XML attributes, Constraints.
● Classes or Screens
● Retrofit, Alamofire, Volley, etc.
● Platform Specific access
● Javascript
● JSX
● Flexbox
● Components
● Fetch API
● Platform specific access
14. Other FP Concepts
● No Shared State.
● Immutability.
● No Side Effects.
● Reusability via Higher Order Functions.
● Reliance on pure functions like map(),
reduce(), filter()
Source: medium.com
16. ● A JavaScript library (and not a framework) working
hand in hand with Native Code.
● Uses JavaScriptCore to run JS layer over native code.
JS Thread
React Native
Bridge
Main
Thread
Yoga
Declare
Components.
Duplex
Communication.
Populate
Components.
Handle layout
rendering
calculations
21. What are React Components?
● Simple JavaScript functions (or
classes) returning Views.
● They can be Stateful(classes) or
Stateless(functional).
● Accept data(props) and describes UI
based on business logic.
import React, { Component } from 'react';
import { Text } from 'react-native';
export default class HelloWorldApp
extends Component {
render() {
return (
<Text>Hello world!</Text>
);
}
}
Stateful Component
Source: medium.com
22. class HelloWorldApp extends Component {
constructor(props) {
super(props)
this.state = {
data: Hello world
}
}
render() {
return (
<Text>{this.state.data}!</Text>
);
}
} Class Component (Stateful)
State
25. Component Props
● Props are properties passed
between components.
● Both class and functional
component accept props.
● Can be accessed using this.props or
by dereferencing.
● Similar to the extras passed via
intent in Android
const HouseCard = (props) => (
<View style={{flexDirection: 'row'}}>
<Text style={{fontSize: 22, marginLeft:
8}}>{props.deviceId}</Text>
</View>
);
27. Component State
● State is a temporary data storage
for component.
● Not to be directly mutated. Use
this.setState() instead.
● this.state should be assigned only
once in the constructor.
● State changes causes re-rendering
inside component.
class HelloWorldApp extends
Component {
constructor(props) {
super(props)
this.state = {
data: Hello world
}
}
}
35. Welcome to Flexbox (LinearLayout clone)
● RN uses flexbox for styling.
● Flexbox sits perfectly with
Android’s LinearLayout analogy.
● Styles are represented in the
form of simple JS objects.
● Attributes are written with
camelCase notations.
43. What’s Next?
● Build cross platform modular apps using React + Redux.
● Start Web dev using ReactJS.
● Build desktop apps using React + Electron.
● Build mobile, web and desktop version of your app, keeping the business
logic code, *exactly same*.
● Build strict and tightly coupled apps using Typescript or Flow.
● Decide if Pure Native is suitable or React Native.