SlideShare uma empresa Scribd logo
1 de 46
From Back-end to Front-end
Kiev 2018
React-Native: Introduction
Ilya Ivanov
Mobile Team Lead at Payoneer Team
Ciklum
About me
React-Native: Introduction
• 1.5 years in react-native
• 3 years in web
• 3 years in C#/.NET
Back-end
Web
front-end
Mobile
front-end
What to expect
• Show React-Native in context
• Explain how React-Native works
• Help you avoid silly mistakes I did
when started
React-Native: Introduction
What not to expect
• Complete course on building mobile apps with React-Native
• I won’t tell you what state management library to use
React-Native: Introduction
Agenda
• Ways to create mobile UI
• React.js in 5 minutes
• React-Native key concepts
• How React-Native works
• Advanced concepts
• React-Native pitfalls
React-Native: Introduction
Ways to create mobile UI
1. Native application (Objective-C or Swift/Java)
2. Website running within mobile browser
3. Hybrid application (HTML/JS/CSS in WebView)
MountainRoad
Hybrid
Cyclo-cross Cross-country
Types of bikes
Web
Web
Code
Browser
Hybrid
Native
Container
Web
Code
Native
Native
App
Ways to create mobile apps summary
• React-Native is a new way to create native apps
• Each approach is a balance between UX and development speed
Agenda
• Ways to create mobile UI
• React.js in 5 minutes
• React-Native key concepts
• How React-Native works
• Advanced concepts
• React-Native pitfalls
React.js in 5 minutes
• Declarative components
• Virtual DOM
• One-way data binding
Declarative components
import React, {Component} from 'react';
class App extends Component {
render() {
return (
<div>
<Title/>
<form>
<div>
<label>Email address</label>
<input type="text"/>
</div>
<br/>
<input type="button" value="Submit"/>
</form>
</div>
);
}
}
Title component
const Title = () =>
<h1>Sign me up!</h1>;
Virtual DOM
div
h1 form
div
label
input
br input
div
Browser DOM
div
h1 form
div
label
input
br input
div
DiffPatch
react-dom
react
One way data binding
Event loop
Handle
Event
Update
state
Re-render
to Virtual
DOM
Reconcile
Browser
DOM
One way data binding
class App extends Component {
state = {};
render() {
return (
<div>
{
this.state.submitted &&
<span>Thanks for submitting your email!</span>
}
<br/>
<input type="button"
value="Submit"
onClick={() => this.setState({submitted: true})}/>
</div>
);
}
}
React.js summary
• Declarative components
• Return virtual DOM elements
• Virtual DOM
• Abstracts away browser’s DOM
• Change DOM via patches
• One-way data binding
• Unidirectional data flow
• Triggered on explicit state changes (via setState call)
Agenda
• Ways to create mobile UI
• React.js in 5 minutes
• React-Native key concepts
• How React-Native works
• Advanced concepts
• React-Native pitfalls
React-Native key concepts
• Ways to bootstrap
• Primitives
• Styling
• Platform-specific code
Bootstrapping your application
react-native init MyApplication
Pros:
• Can use custom native code
• Stable in terms of dev experience
create-react-native-app MyApplication
Pros:
• No need to install Android Studio and Xcode
• Can publish your apps
• You can always eject
Cons:
• Need to install Xcode and Android studio
• Longer feedback cycle
Cons:
• Can’t use custom native code
• Less stable
Initial app
class App extends Component {
render() {
return (
<View style={styles.container}>
<Text>
Welcome to React Native!
</Text>
</View>
);
}
}
Primitives
• View – fundamental component for building a UI. Supports layout
with flexbox.
• Similar to div
• Text – all text should be wrapped into Text component.
• Similar to span
• TouchableOpacity – component to handle user press.
• Somewhat similar to button
class App extends Component {
state = {
count: 0,
};
increment = () =>
this.setState({count: this.state.count + 1});
render() {
return (
<View>
<TouchableOpacity
onPress={this.increment}
>
<Text
{this.state.count}
</Text>
</TouchableOpacity>
</View>
);
}
}
Styling and flexbox
<View style={styles.container}>
<View style={styles.box}/>
<View style={[styles.box, styles.red]}/>
<View style={styles.box}/>
</View>
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'space-around',
alignItems: 'center',
},
box: {
height: 50,
width: 50,
backgroundColor: ’green',
},
red: {
backgroundColor: 'red',
},
});
Flexbox native/web
• flexDirection defaults
• web: row
• native: column
• flex:
• web: flex-grow, flex-shrink, flex-basis
• flex: 2 2 10%;
• native: flex
• flex: 1;
Platform specific code
//from Home.js
import MyComponent from './MyComponent';
Platform specific code
import {Platform} from 'react-native';
const MyComponent = () =>
<Text>{Platform.OS === 'android' ?
'This is Android' :
'This is iOS'}
</Text>;
Key concepts summary
• Bootstrapping
• Start with Expo, eject if needed
• Primitives
• View => div
• Text => span
• TouchableOpacity => button
• Styling
• Flexbox almost identical to web
• Syntax similar to react-style library styling
• Platform-specific code
• Platform-aware vs platform-agnostic components
Agenda
• Ways to create mobile UI
• React.js in 5 minutes
• React-Native key concepts
• How React-Native works
• Advanced concepts
• React-Native pitfalls
React-Native Virtual DOM
View
Text
Android
react-native
react android.view
android.text
iOS
UIView
UILabel
Reconciliation
class App extends Component {
render() {
return (
<View style={styles.container}>
<Text>
Welcome to React Native!
</Text>
</View>
);
}
}
JS runtime
environment Bridge Native Code
How React-Native works
class App extends Component {
state = {
count: 0,
};
increment = () =>
this.setState({count: this.state.count + 1});
render() {
return (
<View>
<TouchableOpacity
onPress={this.increment}
>
<Text
{this.state.count}
</Text>
</TouchableOpacity>
</View>
);
}
}
Event flow
Source: https://www.slideshare.net/rahatkhanna/introduction-to-react-native-rendering-charts-graphs
Agenda
• Ways to create mobile UI
• React.js in 5 minutes
• React-Native key concepts
• How React-Native works
• Advanced concepts
• React-Native pitfalls
Advanced React-Native
• Navigation
• Animation
Navigation
• react-navigation
• JavaScript-based navigation
• react-native-navigation
• Native implementation navigation
Navigation
const ModalStack = StackNavigator({
Home: {
screen: Home,
},
ThreeBoxes: {
screen: ThreeBoxes,
},
});
Home screen
class Home extends Component {
static navigationOptions = {
title: 'Home',
};
render() {
const {navigation} = this.props;
return <View>
<TouchableOpacity
onPress={() => navigation.navigate('ThreeBoxes')}
/>
</View>;
}
}
Argues about smooth 60 FPS animation.
But is using gif in presentation?
Animation
class AnimatedBox extends Component {
scale = new Animated.Value(1);
animate = () => {
const animation = Animated.timing(
this.scale,
{
toValue: 6,
duration: 2000,
useNativeDriver: true,
},
);
animation.start();
};
render() {
const transform = [{scaleX: this.scale}, {scaleY: this.scale}];
return (
<View style={styles.container}>
<TouchableOpacity onPress={this.animate}>
<Animated.View style={[styles.box, {transform}]}/>
</TouchableOpacity>
</View>
);
}
}
Animation: summary
• Runs on the native thread
• Can achieve 60 FPS even on old Android devices
• Doesn’t use setState (out of react.js component lifecycle)
Agenda
• Ways to create mobile UI
• React.js in 5 minutes
• React-Native key concepts
• How React-Native works
• Advanced concepts
• React-Native pitfalls
React-Native pitfalls
• You still might need a native developer
• React-Native favors performance over code readability
• Be very careful with your state management
• Big state updates might lead to performance degradation
• Android and iOS are very different platforms
Summary
• React-Native: no HTML/CSS, native views defined via JavaScript
• Bridge - key part of js  native communication
• Why React-Native?
• You can write great native mobile apps having only web experience
• Reuse your mental models and codebase from web
Thanks
Resources
• Repository for the sample application
• Getting started with React-Native
• Why not Expo?
• How Airnb is using React-Native
• Animate React Native UI Elements

Mais conteúdo relacionado

Mais procurados

Pieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React NativePieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React Nativetlv-ios-dev
 
Unobtrusive JavaScript
Unobtrusive JavaScriptUnobtrusive JavaScript
Unobtrusive JavaScriptVitaly Baum
 
React Native Workshop - React Alicante
React Native Workshop - React AlicanteReact Native Workshop - React Alicante
React Native Workshop - React AlicanteIgnacio Martín
 
Stanislaw potoczny kra_qa_21.01.20
Stanislaw potoczny kra_qa_21.01.20Stanislaw potoczny kra_qa_21.01.20
Stanislaw potoczny kra_qa_21.01.20kraqa
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web ComponentsAndrew Rota
 
[React Native Tutorial] Lecture 6: Component, Props, and Network
[React Native Tutorial] Lecture 6: Component, Props, and Network[React Native Tutorial] Lecture 6: Component, Props, and Network
[React Native Tutorial] Lecture 6: Component, Props, and NetworkKobkrit Viriyayudhakorn
 
Developing, building, testing and deploying react native apps
Developing, building, testing and deploying react native appsDeveloping, building, testing and deploying react native apps
Developing, building, testing and deploying react native appsLeena N
 
Introduction to App Engine Development
Introduction to App Engine DevelopmentIntroduction to App Engine Development
Introduction to App Engine DevelopmentRon Reiter
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in ComponentsFITC
 
Developing Series 40 web apps with Nokia Web Tools 2.0
Developing Series 40 web apps with Nokia Web Tools 2.0Developing Series 40 web apps with Nokia Web Tools 2.0
Developing Series 40 web apps with Nokia Web Tools 2.0Microsoft Mobile Developer
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Foreverstephskardal
 
Agile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automationAgile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automationAgileNCR2013
 
Css3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQueryCss3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQueryAndrea Verlicchi
 
Introduction To Delayed Job
Introduction To Delayed JobIntroduction To Delayed Job
Introduction To Delayed JobJonathan Julian
 
iPhone project - Wireless networks seminar
iPhone project - Wireless networks seminariPhone project - Wireless networks seminar
iPhone project - Wireless networks seminarSilvio Daminato
 

Mais procurados (20)

Pieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React NativePieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React Native
 
React js
React jsReact js
React js
 
Unobtrusive JavaScript
Unobtrusive JavaScriptUnobtrusive JavaScript
Unobtrusive JavaScript
 
React Native Workshop - React Alicante
React Native Workshop - React AlicanteReact Native Workshop - React Alicante
React Native Workshop - React Alicante
 
React Native Firebase
React Native FirebaseReact Native Firebase
React Native Firebase
 
Stanislaw potoczny kra_qa_21.01.20
Stanislaw potoczny kra_qa_21.01.20Stanislaw potoczny kra_qa_21.01.20
Stanislaw potoczny kra_qa_21.01.20
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
[React Native Tutorial] Lecture 6: Component, Props, and Network
[React Native Tutorial] Lecture 6: Component, Props, and Network[React Native Tutorial] Lecture 6: Component, Props, and Network
[React Native Tutorial] Lecture 6: Component, Props, and Network
 
Developing, building, testing and deploying react native apps
Developing, building, testing and deploying react native appsDeveloping, building, testing and deploying react native apps
Developing, building, testing and deploying react native apps
 
Introduction to App Engine Development
Introduction to App Engine DevelopmentIntroduction to App Engine Development
Introduction to App Engine Development
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in Components
 
Developing Series 40 web apps with Nokia Web Tools 2.0
Developing Series 40 web apps with Nokia Web Tools 2.0Developing Series 40 web apps with Nokia Web Tools 2.0
Developing Series 40 web apps with Nokia Web Tools 2.0
 
React-Native Lecture 11: In App Storage
React-Native Lecture 11: In App StorageReact-Native Lecture 11: In App Storage
React-Native Lecture 11: In App Storage
 
AngularJS
AngularJSAngularJS
AngularJS
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Forever
 
Agile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automationAgile NCR 2013 - Gaurav Bansal- web_automation
Agile NCR 2013 - Gaurav Bansal- web_automation
 
Css3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQueryCss3 transitions and animations + graceful degradation with jQuery
Css3 transitions and animations + graceful degradation with jQuery
 
Introduction To Delayed Job
Introduction To Delayed JobIntroduction To Delayed Job
Introduction To Delayed Job
 
Google Polymer Framework
Google Polymer FrameworkGoogle Polymer Framework
Google Polymer Framework
 
iPhone project - Wireless networks seminar
iPhone project - Wireless networks seminariPhone project - Wireless networks seminar
iPhone project - Wireless networks seminar
 

Semelhante a JS Fest 2018. Илья Иванов. Введение в React-Native

React Native: Introduction
React Native: IntroductionReact Native: Introduction
React Native: IntroductionInnerFood
 
Lessons from a year of building apps with React Native
Lessons from a year of building apps with React NativeLessons from a year of building apps with React Native
Lessons from a year of building apps with React NativeRyan Boland
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentanistar sung
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Againjonknapp
 
React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix Chen Lerner
 
ReactJS vs AngularJS - Head to Head comparison
ReactJS vs AngularJS - Head to Head comparisonReactJS vs AngularJS - Head to Head comparison
ReactJS vs AngularJS - Head to Head comparison500Tech
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationAndrew Rota
 
Build Mobile Application with React-Native
Build Mobile Application with React-NativeBuild Mobile Application with React-Native
Build Mobile Application with React-NativeĐình Khởi Đặng
 
Ilya Ivanov - Advanced React-Native
Ilya Ivanov - Advanced React-NativeIlya Ivanov - Advanced React-Native
Ilya Ivanov - Advanced React-NativeOdessaJS Conf
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend DevelopersSergio Nakamura
 
125 고성능 web view-deview 2013 발표 자료_공유용
125 고성능 web view-deview 2013 발표 자료_공유용125 고성능 web view-deview 2013 발표 자료_공유용
125 고성능 web view-deview 2013 발표 자료_공유용NAVER D2
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and SymfonyIgnacio Martín
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Elyse Kolker Gordon
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Nativejoshcjensen
 
reactjs-quiz..docs.pdf
reactjs-quiz..docs.pdfreactjs-quiz..docs.pdf
reactjs-quiz..docs.pdfAyanSarkar78
 

Semelhante a JS Fest 2018. Илья Иванов. Введение в React-Native (20)

React Native: Introduction
React Native: IntroductionReact Native: Introduction
React Native: Introduction
 
Lessons from a year of building apps with React Native
Lessons from a year of building apps with React NativeLessons from a year of building apps with React Native
Lessons from a year of building apps with React Native
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
From Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) AgainFrom Backbone to Ember and Back(bone) Again
From Backbone to Ember and Back(bone) Again
 
React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix React basic by Yoav Amit, Wix
React basic by Yoav Amit, Wix
 
ReactJS vs AngularJS - Head to Head comparison
ReactJS vs AngularJS - Head to Head comparisonReactJS vs AngularJS - Head to Head comparison
ReactJS vs AngularJS - Head to Head comparison
 
React native by example by Vadim Ruban
React native by example by Vadim RubanReact native by example by Vadim Ruban
React native by example by Vadim Ruban
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP Application
 
Build Mobile Application with React-Native
Build Mobile Application with React-NativeBuild Mobile Application with React-Native
Build Mobile Application with React-Native
 
Ilya Ivanov - Advanced React-Native
Ilya Ivanov - Advanced React-NativeIlya Ivanov - Advanced React-Native
Ilya Ivanov - Advanced React-Native
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend Developers
 
Vue js for beginner
Vue js for beginner Vue js for beginner
Vue js for beginner
 
125 고성능 web view-deview 2013 발표 자료_공유용
125 고성능 web view-deview 2013 발표 자료_공유용125 고성능 web view-deview 2013 발표 자료_공유용
125 고성능 web view-deview 2013 발표 자료_공유용
 
React Native
React NativeReact Native
React Native
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and Symfony
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Native
 
Yavorsky
YavorskyYavorsky
Yavorsky
 
reactjs-quiz..docs.pdf
reactjs-quiz..docs.pdfreactjs-quiz..docs.pdf
reactjs-quiz..docs.pdf
 

Mais de JSFestUA

JS Fest 2019/Autumn. Роман Савіцький. Webcomponents & lit-element in production
JS Fest 2019/Autumn. Роман Савіцький. Webcomponents & lit-element in productionJS Fest 2019/Autumn. Роман Савіцький. Webcomponents & lit-element in production
JS Fest 2019/Autumn. Роман Савіцький. Webcomponents & lit-element in productionJSFestUA
 
JS Fest 2019/Autumn. Erick Wendel. 10 secrets to improve Javascript Performance
JS Fest 2019/Autumn. Erick Wendel. 10 secrets to improve Javascript PerformanceJS Fest 2019/Autumn. Erick Wendel. 10 secrets to improve Javascript Performance
JS Fest 2019/Autumn. Erick Wendel. 10 secrets to improve Javascript PerformanceJSFestUA
 
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"JSFestUA
 
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...JSFestUA
 
JS Fest 2019/Autumn. Adam Leos. So why do you need to know Algorithms and Dat...
JS Fest 2019/Autumn. Adam Leos. So why do you need to know Algorithms and Dat...JS Fest 2019/Autumn. Adam Leos. So why do you need to know Algorithms and Dat...
JS Fest 2019/Autumn. Adam Leos. So why do you need to know Algorithms and Dat...JSFestUA
 
JS Fest 2019/Autumn. Marko Letic. Saving the world with JavaScript: A Data Vi...
JS Fest 2019/Autumn. Marko Letic. Saving the world with JavaScript: A Data Vi...JS Fest 2019/Autumn. Marko Letic. Saving the world with JavaScript: A Data Vi...
JS Fest 2019/Autumn. Marko Letic. Saving the world with JavaScript: A Data Vi...JSFestUA
 
JS Fest 2019/Autumn. Александр Товмач. JAMstack
JS Fest 2019/Autumn. Александр Товмач. JAMstackJS Fest 2019/Autumn. Александр Товмач. JAMstack
JS Fest 2019/Autumn. Александр Товмач. JAMstackJSFestUA
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JSFestUA
 
JS Fest 2019/Autumn. Дмитрий Жарков. Blockchainize your SPA or Integrate Java...
JS Fest 2019/Autumn. Дмитрий Жарков. Blockchainize your SPA or Integrate Java...JS Fest 2019/Autumn. Дмитрий Жарков. Blockchainize your SPA or Integrate Java...
JS Fest 2019/Autumn. Дмитрий Жарков. Blockchainize your SPA or Integrate Java...JSFestUA
 
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developersJS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developersJSFestUA
 
JS Fest 2019/Autumn. Kyle Boss. A Tinder Love Story: Create a Wordpress Blog ...
JS Fest 2019/Autumn. Kyle Boss. A Tinder Love Story: Create a Wordpress Blog ...JS Fest 2019/Autumn. Kyle Boss. A Tinder Love Story: Create a Wordpress Blog ...
JS Fest 2019/Autumn. Kyle Boss. A Tinder Love Story: Create a Wordpress Blog ...JSFestUA
 
JS Fest 2019/Autumn. Андрей Старовойт. Зачем нужен тип "true" в TypeScript?
JS Fest 2019/Autumn. Андрей Старовойт. Зачем нужен тип "true" в TypeScript?JS Fest 2019/Autumn. Андрей Старовойт. Зачем нужен тип "true" в TypeScript?
JS Fest 2019/Autumn. Андрей Старовойт. Зачем нужен тип "true" в TypeScript?JSFestUA
 
JS Fest 2019/Autumn. Eyal Eizenberg. Tipping the Scale
JS Fest 2019/Autumn. Eyal Eizenberg. Tipping the ScaleJS Fest 2019/Autumn. Eyal Eizenberg. Tipping the Scale
JS Fest 2019/Autumn. Eyal Eizenberg. Tipping the ScaleJSFestUA
 
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratch
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratchJS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratch
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratchJSFestUA
 
JS Fest 2019/Autumn. Джордж Евтушенко. Как стать программистом, которого хотят
JS Fest 2019/Autumn. Джордж Евтушенко. Как стать программистом, которого хотятJS Fest 2019/Autumn. Джордж Евтушенко. Как стать программистом, которого хотят
JS Fest 2019/Autumn. Джордж Евтушенко. Как стать программистом, которого хотятJSFestUA
 
JS Fest 2019/Autumn. Алексей Орленко. Node.js N-API for Rust
JS Fest 2019/Autumn. Алексей Орленко. Node.js N-API for RustJS Fest 2019/Autumn. Алексей Орленко. Node.js N-API for Rust
JS Fest 2019/Autumn. Алексей Орленко. Node.js N-API for RustJSFestUA
 
JS Fest 2019/Autumn. Daniel Ostrovsky. Falling in love with decorators ES6/Ty...
JS Fest 2019/Autumn. Daniel Ostrovsky. Falling in love with decorators ES6/Ty...JS Fest 2019/Autumn. Daniel Ostrovsky. Falling in love with decorators ES6/Ty...
JS Fest 2019/Autumn. Daniel Ostrovsky. Falling in love with decorators ES6/Ty...JSFestUA
 
JS Fest 2019/Autumn. Андрей Андрийко. Гексагональна архітектура в Nodejs проекті
JS Fest 2019/Autumn. Андрей Андрийко. Гексагональна архітектура в Nodejs проектіJS Fest 2019/Autumn. Андрей Андрийко. Гексагональна архітектура в Nodejs проекті
JS Fest 2019/Autumn. Андрей Андрийко. Гексагональна архітектура в Nodejs проектіJSFestUA
 
JS Fest 2019/Autumn. Борис Могила. Svelte. Почему нам не нужно run-time ядро
JS Fest 2019/Autumn. Борис Могила. Svelte. Почему нам не нужно run-time ядроJS Fest 2019/Autumn. Борис Могила. Svelte. Почему нам не нужно run-time ядро
JS Fest 2019/Autumn. Борис Могила. Svelte. Почему нам не нужно run-time ядроJSFestUA
 
JS Fest 2019/Autumn. Виталий Кухар. Сравнение кластеризации HTTP, TCP и UDP н...
JS Fest 2019/Autumn. Виталий Кухар. Сравнение кластеризации HTTP, TCP и UDP н...JS Fest 2019/Autumn. Виталий Кухар. Сравнение кластеризации HTTP, TCP и UDP н...
JS Fest 2019/Autumn. Виталий Кухар. Сравнение кластеризации HTTP, TCP и UDP н...JSFestUA
 

Mais de JSFestUA (20)

JS Fest 2019/Autumn. Роман Савіцький. Webcomponents & lit-element in production
JS Fest 2019/Autumn. Роман Савіцький. Webcomponents & lit-element in productionJS Fest 2019/Autumn. Роман Савіцький. Webcomponents & lit-element in production
JS Fest 2019/Autumn. Роман Савіцький. Webcomponents & lit-element in production
 
JS Fest 2019/Autumn. Erick Wendel. 10 secrets to improve Javascript Performance
JS Fest 2019/Autumn. Erick Wendel. 10 secrets to improve Javascript PerformanceJS Fest 2019/Autumn. Erick Wendel. 10 secrets to improve Javascript Performance
JS Fest 2019/Autumn. Erick Wendel. 10 secrets to improve Javascript Performance
 
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"
JS Fest 2019/Autumn. Alexandre Gomes. Embrace the "react fatigue"
 
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
JS Fest 2019/Autumn. Anton Cherednikov. Choreographic or orchestral architect...
 
JS Fest 2019/Autumn. Adam Leos. So why do you need to know Algorithms and Dat...
JS Fest 2019/Autumn. Adam Leos. So why do you need to know Algorithms and Dat...JS Fest 2019/Autumn. Adam Leos. So why do you need to know Algorithms and Dat...
JS Fest 2019/Autumn. Adam Leos. So why do you need to know Algorithms and Dat...
 
JS Fest 2019/Autumn. Marko Letic. Saving the world with JavaScript: A Data Vi...
JS Fest 2019/Autumn. Marko Letic. Saving the world with JavaScript: A Data Vi...JS Fest 2019/Autumn. Marko Letic. Saving the world with JavaScript: A Data Vi...
JS Fest 2019/Autumn. Marko Letic. Saving the world with JavaScript: A Data Vi...
 
JS Fest 2019/Autumn. Александр Товмач. JAMstack
JS Fest 2019/Autumn. Александр Товмач. JAMstackJS Fest 2019/Autumn. Александр Товмач. JAMstack
JS Fest 2019/Autumn. Александр Товмач. JAMstack
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
 
JS Fest 2019/Autumn. Дмитрий Жарков. Blockchainize your SPA or Integrate Java...
JS Fest 2019/Autumn. Дмитрий Жарков. Blockchainize your SPA or Integrate Java...JS Fest 2019/Autumn. Дмитрий Жарков. Blockchainize your SPA or Integrate Java...
JS Fest 2019/Autumn. Дмитрий Жарков. Blockchainize your SPA or Integrate Java...
 
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developersJS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
JS Fest 2019/Autumn. Maciej Treder. Angular Schematics - Develop for developers
 
JS Fest 2019/Autumn. Kyle Boss. A Tinder Love Story: Create a Wordpress Blog ...
JS Fest 2019/Autumn. Kyle Boss. A Tinder Love Story: Create a Wordpress Blog ...JS Fest 2019/Autumn. Kyle Boss. A Tinder Love Story: Create a Wordpress Blog ...
JS Fest 2019/Autumn. Kyle Boss. A Tinder Love Story: Create a Wordpress Blog ...
 
JS Fest 2019/Autumn. Андрей Старовойт. Зачем нужен тип "true" в TypeScript?
JS Fest 2019/Autumn. Андрей Старовойт. Зачем нужен тип "true" в TypeScript?JS Fest 2019/Autumn. Андрей Старовойт. Зачем нужен тип "true" в TypeScript?
JS Fest 2019/Autumn. Андрей Старовойт. Зачем нужен тип "true" в TypeScript?
 
JS Fest 2019/Autumn. Eyal Eizenberg. Tipping the Scale
JS Fest 2019/Autumn. Eyal Eizenberg. Tipping the ScaleJS Fest 2019/Autumn. Eyal Eizenberg. Tipping the Scale
JS Fest 2019/Autumn. Eyal Eizenberg. Tipping the Scale
 
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratch
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratchJS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratch
JS Fest 2019/Autumn. Sota Ohara. Сreate own server less CMS from scratch
 
JS Fest 2019/Autumn. Джордж Евтушенко. Как стать программистом, которого хотят
JS Fest 2019/Autumn. Джордж Евтушенко. Как стать программистом, которого хотятJS Fest 2019/Autumn. Джордж Евтушенко. Как стать программистом, которого хотят
JS Fest 2019/Autumn. Джордж Евтушенко. Как стать программистом, которого хотят
 
JS Fest 2019/Autumn. Алексей Орленко. Node.js N-API for Rust
JS Fest 2019/Autumn. Алексей Орленко. Node.js N-API for RustJS Fest 2019/Autumn. Алексей Орленко. Node.js N-API for Rust
JS Fest 2019/Autumn. Алексей Орленко. Node.js N-API for Rust
 
JS Fest 2019/Autumn. Daniel Ostrovsky. Falling in love with decorators ES6/Ty...
JS Fest 2019/Autumn. Daniel Ostrovsky. Falling in love with decorators ES6/Ty...JS Fest 2019/Autumn. Daniel Ostrovsky. Falling in love with decorators ES6/Ty...
JS Fest 2019/Autumn. Daniel Ostrovsky. Falling in love with decorators ES6/Ty...
 
JS Fest 2019/Autumn. Андрей Андрийко. Гексагональна архітектура в Nodejs проекті
JS Fest 2019/Autumn. Андрей Андрийко. Гексагональна архітектура в Nodejs проектіJS Fest 2019/Autumn. Андрей Андрийко. Гексагональна архітектура в Nodejs проекті
JS Fest 2019/Autumn. Андрей Андрийко. Гексагональна архітектура в Nodejs проекті
 
JS Fest 2019/Autumn. Борис Могила. Svelte. Почему нам не нужно run-time ядро
JS Fest 2019/Autumn. Борис Могила. Svelte. Почему нам не нужно run-time ядроJS Fest 2019/Autumn. Борис Могила. Svelte. Почему нам не нужно run-time ядро
JS Fest 2019/Autumn. Борис Могила. Svelte. Почему нам не нужно run-time ядро
 
JS Fest 2019/Autumn. Виталий Кухар. Сравнение кластеризации HTTP, TCP и UDP н...
JS Fest 2019/Autumn. Виталий Кухар. Сравнение кластеризации HTTP, TCP и UDP н...JS Fest 2019/Autumn. Виталий Кухар. Сравнение кластеризации HTTP, TCP и UDP н...
JS Fest 2019/Autumn. Виталий Кухар. Сравнение кластеризации HTTP, TCP и UDP н...
 

Último

Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 

Último (20)

Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

JS Fest 2018. Илья Иванов. Введение в React-Native

  • 1. From Back-end to Front-end Kiev 2018 React-Native: Introduction Ilya Ivanov Mobile Team Lead at Payoneer Team Ciklum
  • 2. About me React-Native: Introduction • 1.5 years in react-native • 3 years in web • 3 years in C#/.NET Back-end Web front-end Mobile front-end
  • 3. What to expect • Show React-Native in context • Explain how React-Native works • Help you avoid silly mistakes I did when started React-Native: Introduction
  • 4. What not to expect • Complete course on building mobile apps with React-Native • I won’t tell you what state management library to use React-Native: Introduction
  • 5. Agenda • Ways to create mobile UI • React.js in 5 minutes • React-Native key concepts • How React-Native works • Advanced concepts • React-Native pitfalls React-Native: Introduction
  • 6. Ways to create mobile UI 1. Native application (Objective-C or Swift/Java) 2. Website running within mobile browser 3. Hybrid application (HTML/JS/CSS in WebView)
  • 9. Ways to create mobile apps summary • React-Native is a new way to create native apps • Each approach is a balance between UX and development speed
  • 10. Agenda • Ways to create mobile UI • React.js in 5 minutes • React-Native key concepts • How React-Native works • Advanced concepts • React-Native pitfalls
  • 11. React.js in 5 minutes • Declarative components • Virtual DOM • One-way data binding
  • 12. Declarative components import React, {Component} from 'react'; class App extends Component { render() { return ( <div> <Title/> <form> <div> <label>Email address</label> <input type="text"/> </div> <br/> <input type="button" value="Submit"/> </form> </div> ); } }
  • 13. Title component const Title = () => <h1>Sign me up!</h1>;
  • 14. Virtual DOM div h1 form div label input br input div Browser DOM div h1 form div label input br input div DiffPatch react-dom react
  • 15. One way data binding Event loop Handle Event Update state Re-render to Virtual DOM Reconcile Browser DOM
  • 16. One way data binding class App extends Component { state = {}; render() { return ( <div> { this.state.submitted && <span>Thanks for submitting your email!</span> } <br/> <input type="button" value="Submit" onClick={() => this.setState({submitted: true})}/> </div> ); } }
  • 17. React.js summary • Declarative components • Return virtual DOM elements • Virtual DOM • Abstracts away browser’s DOM • Change DOM via patches • One-way data binding • Unidirectional data flow • Triggered on explicit state changes (via setState call)
  • 18. Agenda • Ways to create mobile UI • React.js in 5 minutes • React-Native key concepts • How React-Native works • Advanced concepts • React-Native pitfalls
  • 19. React-Native key concepts • Ways to bootstrap • Primitives • Styling • Platform-specific code
  • 20. Bootstrapping your application react-native init MyApplication Pros: • Can use custom native code • Stable in terms of dev experience create-react-native-app MyApplication Pros: • No need to install Android Studio and Xcode • Can publish your apps • You can always eject Cons: • Need to install Xcode and Android studio • Longer feedback cycle Cons: • Can’t use custom native code • Less stable
  • 21. Initial app class App extends Component { render() { return ( <View style={styles.container}> <Text> Welcome to React Native! </Text> </View> ); } }
  • 22. Primitives • View – fundamental component for building a UI. Supports layout with flexbox. • Similar to div • Text – all text should be wrapped into Text component. • Similar to span • TouchableOpacity – component to handle user press. • Somewhat similar to button
  • 23. class App extends Component { state = { count: 0, }; increment = () => this.setState({count: this.state.count + 1}); render() { return ( <View> <TouchableOpacity onPress={this.increment} > <Text {this.state.count} </Text> </TouchableOpacity> </View> ); } }
  • 24. Styling and flexbox <View style={styles.container}> <View style={styles.box}/> <View style={[styles.box, styles.red]}/> <View style={styles.box}/> </View> const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'space-around', alignItems: 'center', }, box: { height: 50, width: 50, backgroundColor: ’green', }, red: { backgroundColor: 'red', }, });
  • 25. Flexbox native/web • flexDirection defaults • web: row • native: column • flex: • web: flex-grow, flex-shrink, flex-basis • flex: 2 2 10%; • native: flex • flex: 1;
  • 26. Platform specific code //from Home.js import MyComponent from './MyComponent';
  • 27. Platform specific code import {Platform} from 'react-native'; const MyComponent = () => <Text>{Platform.OS === 'android' ? 'This is Android' : 'This is iOS'} </Text>;
  • 28. Key concepts summary • Bootstrapping • Start with Expo, eject if needed • Primitives • View => div • Text => span • TouchableOpacity => button • Styling • Flexbox almost identical to web • Syntax similar to react-style library styling • Platform-specific code • Platform-aware vs platform-agnostic components
  • 29. Agenda • Ways to create mobile UI • React.js in 5 minutes • React-Native key concepts • How React-Native works • Advanced concepts • React-Native pitfalls
  • 30. React-Native Virtual DOM View Text Android react-native react android.view android.text iOS UIView UILabel Reconciliation class App extends Component { render() { return ( <View style={styles.container}> <Text> Welcome to React Native! </Text> </View> ); } }
  • 31. JS runtime environment Bridge Native Code How React-Native works
  • 32. class App extends Component { state = { count: 0, }; increment = () => this.setState({count: this.state.count + 1}); render() { return ( <View> <TouchableOpacity onPress={this.increment} > <Text {this.state.count} </Text> </TouchableOpacity> </View> ); } }
  • 34. Agenda • Ways to create mobile UI • React.js in 5 minutes • React-Native key concepts • How React-Native works • Advanced concepts • React-Native pitfalls
  • 36. Navigation • react-navigation • JavaScript-based navigation • react-native-navigation • Native implementation navigation
  • 37. Navigation const ModalStack = StackNavigator({ Home: { screen: Home, }, ThreeBoxes: { screen: ThreeBoxes, }, });
  • 38. Home screen class Home extends Component { static navigationOptions = { title: 'Home', }; render() { const {navigation} = this.props; return <View> <TouchableOpacity onPress={() => navigation.navigate('ThreeBoxes')} /> </View>; } }
  • 39. Argues about smooth 60 FPS animation. But is using gif in presentation?
  • 40. Animation class AnimatedBox extends Component { scale = new Animated.Value(1); animate = () => { const animation = Animated.timing( this.scale, { toValue: 6, duration: 2000, useNativeDriver: true, }, ); animation.start(); }; render() { const transform = [{scaleX: this.scale}, {scaleY: this.scale}]; return ( <View style={styles.container}> <TouchableOpacity onPress={this.animate}> <Animated.View style={[styles.box, {transform}]}/> </TouchableOpacity> </View> ); } }
  • 41. Animation: summary • Runs on the native thread • Can achieve 60 FPS even on old Android devices • Doesn’t use setState (out of react.js component lifecycle)
  • 42. Agenda • Ways to create mobile UI • React.js in 5 minutes • React-Native key concepts • How React-Native works • Advanced concepts • React-Native pitfalls
  • 43. React-Native pitfalls • You still might need a native developer • React-Native favors performance over code readability • Be very careful with your state management • Big state updates might lead to performance degradation • Android and iOS are very different platforms
  • 44. Summary • React-Native: no HTML/CSS, native views defined via JavaScript • Bridge - key part of js  native communication • Why React-Native? • You can write great native mobile apps having only web experience • Reuse your mental models and codebase from web
  • 46. Resources • Repository for the sample application • Getting started with React-Native • Why not Expo? • How Airnb is using React-Native • Animate React Native UI Elements