react-native · •react framework + native development •react primitives render to native...

28
React-Native García Álvarez, Pelayo González Meléndez, Alejandro Gutiérrez Fernández, Íñigo Megido García, Lucía

Upload: others

Post on 21-Sep-2020

56 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

React-Native

• García Álvarez, Pelayo

• González Meléndez, Alejandro

• Gutiérrez Fernández, Íñigo

• Megido García, Lucía

Page 2: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

What is React Native?

• Multiplatform development environment

• Native development

• Released by Facebook in 2015

Page 3: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

How does it work?

• React framework + Native development

• React primitives render to native platform UI

• Core components mapping to native UI building blocks:

• View

• ScrollView

• ImageView

• Text

• …

Page 4: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Stakeholders

Pow

er

Page 5: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Quality Attributes

Page 6: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Reusability and Learnability

• One code base →multiple platforms (IOS, Android, UWP, …)

• Written in JSX, syntax extension to JavaScript

Page 7: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Modularity and

Community Support

• Open Source

• Uses npm

• Components → great collection of third-party libraries

Page 8: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Performance • Mostly native code, be it Swift, Java or C#

Page 9: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Usability • React Native focuses on UI design

• Responsive

Page 10: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Security and Reliability

• Native code should be more stable and secure

• Maintained by Facebook

Page 11: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Constraints

• JavaScript

• NodeJs

• Package Manager (npm, yarn…)

• Python

• Reusability

Page 12: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Features and modules

Page 13: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

How does it work?

• React + native capabilities

• Javascript -> access platform API's

• React Components

Page 14: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Core Components

• <View>

• <Text>

• <Image>

• <ScrollView>

• <TextInput>

Page 15: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Native Modules

• Javascript functions

• Implemented natively for each platform

• When is it used?• Capabilities needed -> React Native does not include a module

Page 16: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Creating a Native Module

• Create the application

• Create the module

• Add module in package.json

Page 17: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Architecture

Page 18: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

[…, createView(id, RCTView, ...)]view.appendChild(RCTView)

Platform UI Layout(Shadow Tree)

JavaScript

onScroll

Page 19: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Fabric

Page 20: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Platform UI Layout JavaScript

Java

Scri

pt

Inte

rfac

e (J

SI)

getNativeModule('GPS').getCoordinates()

Page 21: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Native Modules

getNativeModule('GPS').getCoordinates()

const coordinates

getNativeModule('Uploader').upload(coordinates)

JSON

JSON

Android JavaScript

Page 22: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Native Modules

getNativeModule('GPS').getCoordinates()

const coordinates

getNativeModule('Uploader').upload(coordinates)

Android JavaScript

void* coordinates

coordinates .setAlpha(0)

Page 23: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Application

Expo CLI QuickStart – React Native CLI

Page 24: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Expo CLI

Page 25: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support
Page 26: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

React CLI• Requirements: Node, python2 and jdk

• Android Studio: • Android SDK

• Android SDK Platform

• Intel HAXM (or AMD equivalent)

• Android Virtual Device

Page 27: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support
Page 28: React-Native · •React framework + Native development •React primitives render to native platform UI •Core components mapping to native UI building blocks: ... Community Support

Thanks for your attention!