SlideShare uma empresa Scribd logo
1 de 39
Baixar para ler offline
REACT NATIVE
MOJOTECH REACT SYMPOSIUM 2016
WHAT IS
REACT NATIVE?
WHAT IS REACT NATIVE
MAIN FEATURES
▸ Native Components
▸ Asynchronous Execution
▸ Touch Handling
▸ Flexbox & Styling
▸ Polyfills
▸ Extensible
GETTING STARTED
GETTING STARTED
COMMON PREREQUISITES
▸ Node.js 4.0+
▸ React Native Command Line Tools
▸ $ npm install -g react-native-cli
GETTING STARTED
PREREQUISITES FOR IOS APPLICATIONS
▸ Xcode
▸ which means you will need a Mac
GETTING STARTED
PREREQUISITES FOR ANDROID APPLICATIONS
▸ Android Studio 2.0+
▸ JDK 1.8+
▸ Setting the ANDROID_HOME environment variable
TOOLING AND
DEVELOPMENT
TOOLING AND DEVELOPMENT
RUNNING YOUR APPLICATION
▸ IOS
▸ $ react-native run-ios
▸ edit index.ios.js
▸ Android
▸ $ react-native run-android
▸ edit index.android.js
TOOLING AND DEVELOPMENT
PLATFORM SPECIFIC CODE
▸ You can choose your method for keeping platform specific
code organized
▸ /common/components

/android/components

/ios/components
▸ MyCustomButtonIOS.js

MyCustomButtonAndroid.js
TOOLING AND DEVELOPMENT
PLATFORM SPECIFIC CODE
▸ React Native provides a nicer way to do this also, with
platform specific extensions
▸ MyCustomButton.ios.js

MyCustomButton.android.js
▸ import MyCustomButton from ‘./components/MyCustomButton’;
TOOLING AND DEVELOPMENT
PLATFORM DETECTION
▸ React Native provides the Platform module for detecting
run time environment, when only small tweaks are needed
based on platform, and not a completely unique
component.
▸ Platform.OS === “ios” 

Platform.OS === “android”
1 var { Platform } = React;
2
3 var styles = StyleSheet.create({
4 height: (Platform.OS === 'ios') ? 200 : 180
5 });
TOOLING AND DEVELOPMENT
PLATFORM DETECTION
▸ React Native provides the Platform module for detecting
run time environment, when only small tweaks are needed
based on platform, and not a completely unique
component.
▸ Platform.Select 
 1 var Component = Platform.select({
2 ios: () => require('ComponentIOS'),
3 android: () => require('ComponentAndroid')
4 });
5
6 <Component />
1 var { Platform } = React;
2
3 var styles = StyleSheet.create({
4 container: {
5 flex: 1,
6 ...Platform.select({
7 ios: { backgroundColor: 'red' },
8 android: { backgroundColor: 'blue' }
9 })
10 }
11 });
STYLING YOUR
REACT NATIVE APP
STYLING YOUR REACT NATIVE APP
STYLES ARE IMPLEMENTED WITH JAVASCRIPT
▸ React Native layout
1 var styles = StyleSheet.create({
2 base: {
3 width: 38,
4 height: 38,
5 },
6 background: {
7 backgroundColor: '#222222',
8 },
9 active: {
10 borderWidth: 2,
11 borderColor: '#00ff00',
12 },
13 });
STYLING YOUR REACT NATIVE APP
STYLES ARE IMPLEMENTED WITH JAVASCRIPT
▸ All React Native core components accept a `style` attribute
▸ Both a single value or an array of values (mimics
`Object.assign` with the right-most values taking priority)
1 <Text style={styles.base} />
2 <View style={styles.background} />
3
4 <View style={[styles.base, styles.background]} />
5
6 <View style={[styles.base, this.state.active && styles.active]} />
STYLING YOUR REACT NATIVE APP
STYLES CAN BE PASSED AROUND AS PROPS
1 var List = React.createClass({
2 propTypes: {
3 style: View.propTypes.style,
4 elementStyle: View.propTypes.style,
5 },
6 render: function() {
7 return (
8 <View style={this.props.style}>
9 {elements.map((element) =>
10 <View style={[styles.element, this.props.elementStyle]} />
11 )}
12 </View>
13 );
14 }
15 });
16
17 // ... in another file ...
18 <List style={styles.list} elementStyle={styles.listElement} />
APP DEPLOYMENT
YEAH, SO HAVE FUN WITH
THAT…
Craig P Jolicoeur
APP DEPLOYMENT
RECOMMENDATIONS
RECOMMENDATIONS
SINGLE MAIN APP ENTRY POINT
▸ Use a single `app.jsx` file as your main entry point instead
of maintaining both `index.ios.js` and `index.android.js`
1 // index.{ios,android}.js
2 import { AppRegistry } from 'react-native';
3 import App from './app';
4
5 AppRegistry.registerComponent('MyApp', () => App);
6
7 // app.js
8 import React from 'react-native';
9 import { Provider } from 'react-redux';
10 import AppLoader from './components/app_loader';
11 import ReduxStore from './redux/store';
12
13 const MyApp = () => (
14 <Provider store={ReduxStore.store()}>
15 <AppLoader />
16 </Provider>
17 );
18
19 export default MyApp;
RECOMMENDATIONS
INTEGRATE FABRIC.IO
▸ Setup on Fabric (Crashlytics) as a custom logger in both iOS and
Android
▸ https://get.fabric.io/
▸ https://github.com/corymsmith/react-native-fabric
▸ https://medium.com/delivery-com-engineering/add-crashlytics-
to-your-react-native-ios-app-69a983a9062a#.35n80bfig
▸ (Android blog post to follow)
RECOMMENDATIONS
GENYMOTION
▸ Use the Genymotion Android Emulator for speed
improvements.
▸ The newer Android Studio 2.0+ emulator is much better
than it’s predecessor for native application dev (code
hot-swapping, etc…) but still behind Genymotion for
React Native development
▸ https://www.genymotion.com/
RECOMMENDATIONS
REACT-NATIVE-MAPS
▸ https://github.com/
lelandrichardson/react-
native-maps
▸ https://www.npmjs.com/
package/react-native-maps
RECOMMENDATIONS
REACT-NATIVE-LOCALIZATION
▸ https://github.com/stefalda/ReactNativeLocalization
▸ https://www.npmjs.com/package/react-native-localization
1 import LocalizedStrings from 'react-native-localization';
2
3 let strings = new LocalizedStrings({
4 en:{
5 how:"How do you want your egg today?",
6 boiledEgg:"Boiled egg"
7 },
8 it: {
9 how:"Come vuoi il tuo uovo oggi?",
10 boiledEgg:"Uovo sodo"
11 }
12 });
13
14 // In your component
15 <Text style={styles.title}>{strings.how}</Text>
1 import LocalizedStrings from 'react-native-localization';
2
3 let strings = new LocalizedStrings({
4 en:{
5 bread: "bread",
6 butter: "butter",
7 question: "Would you like {0} and {1}, or just {0}?"
8 },
9 ...
10 });
11
12 // In your component
13 <Text style={styles.title}>
14 {strings.formatString(strings.question, strings.bread, strings.butter)}
15 </Text>
RECOMMENDATIONS
REACT-NATIVE-RADIO-BUTTONS
▸ https://github.com/ArnaudRinquin/react-native-radio-
buttons
▸ https://www.npmjs.com/package/react-native-radio-
buttons
RECOMMENDATIONS
REACT-NATIVE-SWIPEOUT
▸ https://github.com/dancormier/react-native-swipeout
▸ https://www.npmjs.com/package/react-native-swipeout
RECOMMENDATIONS
JS.COACH
▸ https://js.coach/
PROS / CONS
PROS / CONS
THE GOOD
▸ Single unified codebase (less knowledge required, fewer
developers to maintain apps on two platforms)
▸ Single point of incoming errors/failures (only need to
debug one codebase)
▸ Faster development time for teams without experienced
Swift/Objective-C or Android SDK engineers
▸ Potential portability of components between mobile and
web versions of the same React application
PROS / CONS
THE BAD (MAYBE)
▸ Can be harder to add custom components
▸ Not as much control over styling/graphics/animations as on a
purely native platform
▸ Harder to profile performance and finely tune
▸ Not necessarily faster dev cycle then purely native applications.
▸ Project is still under heavy, active development and things
“break” often between releases
▸ Debugging while developing is “unpleasant”
EXTRA TOOLS
EXTRA TOOLS
PEPPERONI
▸ Pre-built boilerplate with features for login/authentication,
messaging, push notifications, cloud-based backend,
CodePush for direct app updates, etc…
▸ http://getpepperoni.com/
EXTRA TOOLS
CODEPUSH
▸ Open Source tool from Microsoft allowing you to push
code updates to your app instantly for Cordova and React
Native applications.
▸ http://microsoft.github.io/code-push/
EXTRA TOOLS
FASTLANE
▸ Automation done right (no really). Use this tool for native
development, not only React Native. Ease of deployment,
provisioning, certificate management, beta process, etc…
▸ https://fastlane.tools/
EXTRA TOOLS
RNPM
▸ React Native Package Manager built to ease your daily
React Native development. Inspired by CocoaPods,
Fastlane and react-native link
▸ https://github.com/rnpm/rnpm
EXTRA TOOLS
NUCLIDE
▸ React Native IDE built on top of Atom (by Facebook)
▸ Built in Chrome debugger, remote server access, Hack
language support, etc…
▸ https://nuclide.io/
EXTRA TOOLS
DECO IDE
▸ React Native IDE (OS X only)
▸ Live visual feedback on updates, drag-and-drop
component implementation, new file scaffold
boilerplate
▸ https://github.com/decosoftware/deco-ide

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
React Native
React NativeReact Native
React Native
 
React Native - Getting Started
React Native - Getting StartedReact Native - Getting Started
React Native - Getting Started
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
 
Its time to React.js
Its time to React.jsIts time to React.js
Its time to React.js
 
Introduction to react native
Introduction to react nativeIntroduction to react native
Introduction to react native
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
React Native
React Native React Native
React Native
 
Introduction to React Native Workshop
Introduction to React Native WorkshopIntroduction to React Native Workshop
Introduction to React Native Workshop
 
Jetpack Compose beginner.pdf
Jetpack Compose beginner.pdfJetpack Compose beginner.pdf
Jetpack Compose beginner.pdf
 
Flutter
FlutterFlutter
Flutter
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
reactJS
reactJSreactJS
reactJS
 
Jetpack Compose.pptx
Jetpack Compose.pptxJetpack Compose.pptx
Jetpack Compose.pptx
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
 
React state
React  stateReact  state
React state
 

Destaque

A tour of React Native
A tour of React NativeA tour of React Native
A tour of React NativeTadeu Zagallo
 
React Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScriptReact Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScriptKobkrit Viriyayudhakorn
 
Success stories from agencies
Success stories from agenciesSuccess stories from agencies
Success stories from agenciesWistiaFest
 
深入淺出RoR
深入淺出RoR深入淺出RoR
深入淺出RoREric Lee
 
React native. Bridge From Web To Mobile. Intro
React native. Bridge From Web To Mobile. IntroReact native. Bridge From Web To Mobile. Intro
React native. Bridge From Web To Mobile. IntroIgor Izraylevych
 
React Native Intro
React Native IntroReact Native Intro
React Native IntroJulia Vi
 
React Native + Redux
React Native + ReduxReact Native + Redux
React Native + ReduxCh Rick
 
Hardware Acceleration in WebKit
Hardware Acceleration in WebKitHardware Acceleration in WebKit
Hardware Acceleration in WebKitJoone Hur
 
JavaScript, React Native and Performance at react-europe 2016
JavaScript, React Native and Performance at react-europe 2016JavaScript, React Native and Performance at react-europe 2016
JavaScript, React Native and Performance at react-europe 2016Tadeu Zagallo
 
Styling React Native Applications
Styling React Native ApplicationsStyling React Native Applications
Styling React Native ApplicationsJan Maršíček
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React NativePolidea
 
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 RevolutionWebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolutionjuanjosanchezpenas
 
Understanding Webkit Rendering
Understanding Webkit RenderingUnderstanding Webkit Rendering
Understanding Webkit RenderingAriya Hidayat
 

Destaque (20)

A tour of React Native
A tour of React NativeA tour of React Native
A tour of React Native
 
React Native
React NativeReact Native
React Native
 
React Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScriptReact Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScript
 
Is React reactive?
Is React reactive?Is React reactive?
Is React reactive?
 
React & Redux
React & ReduxReact & Redux
React & Redux
 
Success stories from agencies
Success stories from agenciesSuccess stories from agencies
Success stories from agencies
 
React Ecosystem
React EcosystemReact Ecosystem
React Ecosystem
 
深入淺出RoR
深入淺出RoR深入淺出RoR
深入淺出RoR
 
React native. Bridge From Web To Mobile. Intro
React native. Bridge From Web To Mobile. IntroReact native. Bridge From Web To Mobile. Intro
React native. Bridge From Web To Mobile. Intro
 
React Native Intro
React Native IntroReact Native Intro
React Native Intro
 
The productive developer guide to React
The productive developer guide to ReactThe productive developer guide to React
The productive developer guide to React
 
React Native + Redux
React Native + ReduxReact Native + Redux
React Native + Redux
 
Building UWP apps with React-Native
Building UWP apps with React-NativeBuilding UWP apps with React-Native
Building UWP apps with React-Native
 
Hardware Acceleration in WebKit
Hardware Acceleration in WebKitHardware Acceleration in WebKit
Hardware Acceleration in WebKit
 
Navigation in React Native
Navigation in React NativeNavigation in React Native
Navigation in React Native
 
JavaScript, React Native and Performance at react-europe 2016
JavaScript, React Native and Performance at react-europe 2016JavaScript, React Native and Performance at react-europe 2016
JavaScript, React Native and Performance at react-europe 2016
 
Styling React Native Applications
Styling React Native ApplicationsStyling React Native Applications
Styling React Native Applications
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 RevolutionWebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
 
Understanding Webkit Rendering
Understanding Webkit RenderingUnderstanding Webkit Rendering
Understanding Webkit Rendering
 

Semelhante a React Native

How To Integrate Native Android App With React Native.
How To Integrate Native Android App With React Native.How To Integrate Native Android App With React Native.
How To Integrate Native Android App With React Native.Techugo
 
Lecture 1 Introduction to React Native.pptx
Lecture 1 Introduction to React Native.pptxLecture 1 Introduction to React Native.pptx
Lecture 1 Introduction to React Native.pptxGevitaChinnaiah
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsMatteo Manchi
 
DMCA #25: Jenkins - Docker & Android: Comment Docker peu faciliter la créatio...
DMCA #25: Jenkins - Docker & Android: Comment Docker peu faciliter la créatio...DMCA #25: Jenkins - Docker & Android: Comment Docker peu faciliter la créatio...
DMCA #25: Jenkins - Docker & Android: Comment Docker peu faciliter la créatio...Olivier Destrebecq
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)Chiew Carol
 
Ultimate Survival - React-Native edition
Ultimate Survival - React-Native editionUltimate Survival - React-Native edition
Ultimate Survival - React-Native editionRichard Radics
 
Introduction phonegap
Introduction phonegapIntroduction phonegap
Introduction phonegapRakesh Jha
 
Advanced programing in phonegap
Advanced programing in phonegapAdvanced programing in phonegap
Advanced programing in phonegapRakesh Jha
 
Hacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdfHacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdfShaiAlmog1
 
Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDKKirill Kounik
 
TK2323 Lecture 1 - Introduction to Mobile Application.pdf
TK2323 Lecture 1 - Introduction to Mobile Application.pdfTK2323 Lecture 1 - Introduction to Mobile Application.pdf
TK2323 Lecture 1 - Introduction to Mobile Application.pdfLam Chun
 
Visage Android Hands-on Lab (OSCON)
Visage Android Hands-on Lab (OSCON)Visage Android Hands-on Lab (OSCON)
Visage Android Hands-on Lab (OSCON)Stephen Chin
 
Parkjihoon phonegap research_for_bada
Parkjihoon phonegap research_for_badaParkjihoon phonegap research_for_bada
Parkjihoon phonegap research_for_bada웹데브모바일
 
Building Cross-Platform JavaScript Apps using Cordova
Building Cross-Platform JavaScript Apps using CordovaBuilding Cross-Platform JavaScript Apps using Cordova
Building Cross-Platform JavaScript Apps using CordovaNoam Kfir
 
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
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspectiveGunjan Kumar
 
React Native for ReactJS Devs
React Native for ReactJS DevsReact Native for ReactJS Devs
React Native for ReactJS DevsBarak Cohen
 

Semelhante a React Native (20)

How To Integrate Native Android App With React Native.
How To Integrate Native Android App With React Native.How To Integrate Native Android App With React Native.
How To Integrate Native Android App With React Native.
 
React Native
React NativeReact Native
React Native
 
Lecture 1 Introduction to React Native.pptx
Lecture 1 Introduction to React Native.pptxLecture 1 Introduction to React Native.pptx
Lecture 1 Introduction to React Native.pptx
 
Nativescript with angular 2
Nativescript with angular 2Nativescript with angular 2
Nativescript with angular 2
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applications
 
DMCA #25: Jenkins - Docker & Android: Comment Docker peu faciliter la créatio...
DMCA #25: Jenkins - Docker & Android: Comment Docker peu faciliter la créatio...DMCA #25: Jenkins - Docker & Android: Comment Docker peu faciliter la créatio...
DMCA #25: Jenkins - Docker & Android: Comment Docker peu faciliter la créatio...
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
Ultimate Survival - React-Native edition
Ultimate Survival - React-Native editionUltimate Survival - React-Native edition
Ultimate Survival - React-Native edition
 
Introduction phonegap
Introduction phonegapIntroduction phonegap
Introduction phonegap
 
Advanced programing in phonegap
Advanced programing in phonegapAdvanced programing in phonegap
Advanced programing in phonegap
 
Hacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdfHacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdf
 
Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDK
 
TK2323 Lecture 1 - Introduction to Mobile Application.pdf
TK2323 Lecture 1 - Introduction to Mobile Application.pdfTK2323 Lecture 1 - Introduction to Mobile Application.pdf
TK2323 Lecture 1 - Introduction to Mobile Application.pdf
 
React native.key
React native.keyReact native.key
React native.key
 
Visage Android Hands-on Lab (OSCON)
Visage Android Hands-on Lab (OSCON)Visage Android Hands-on Lab (OSCON)
Visage Android Hands-on Lab (OSCON)
 
Parkjihoon phonegap research_for_bada
Parkjihoon phonegap research_for_badaParkjihoon phonegap research_for_bada
Parkjihoon phonegap research_for_bada
 
Building Cross-Platform JavaScript Apps using Cordova
Building Cross-Platform JavaScript Apps using CordovaBuilding Cross-Platform JavaScript Apps using Cordova
Building Cross-Platform JavaScript Apps using Cordova
 
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
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
 
React Native for ReactJS Devs
React Native for ReactJS DevsReact Native for ReactJS Devs
React Native for ReactJS Devs
 

Último

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburgmasabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Último (20)

%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

React Native

  • 3. WHAT IS REACT NATIVE MAIN FEATURES ▸ Native Components ▸ Asynchronous Execution ▸ Touch Handling ▸ Flexbox & Styling ▸ Polyfills ▸ Extensible
  • 4.
  • 6. GETTING STARTED COMMON PREREQUISITES ▸ Node.js 4.0+ ▸ React Native Command Line Tools ▸ $ npm install -g react-native-cli
  • 7. GETTING STARTED PREREQUISITES FOR IOS APPLICATIONS ▸ Xcode ▸ which means you will need a Mac
  • 8. GETTING STARTED PREREQUISITES FOR ANDROID APPLICATIONS ▸ Android Studio 2.0+ ▸ JDK 1.8+ ▸ Setting the ANDROID_HOME environment variable
  • 10. TOOLING AND DEVELOPMENT RUNNING YOUR APPLICATION ▸ IOS ▸ $ react-native run-ios ▸ edit index.ios.js ▸ Android ▸ $ react-native run-android ▸ edit index.android.js
  • 11. TOOLING AND DEVELOPMENT PLATFORM SPECIFIC CODE ▸ You can choose your method for keeping platform specific code organized ▸ /common/components
 /android/components
 /ios/components ▸ MyCustomButtonIOS.js
 MyCustomButtonAndroid.js
  • 12. TOOLING AND DEVELOPMENT PLATFORM SPECIFIC CODE ▸ React Native provides a nicer way to do this also, with platform specific extensions ▸ MyCustomButton.ios.js
 MyCustomButton.android.js ▸ import MyCustomButton from ‘./components/MyCustomButton’;
  • 13. TOOLING AND DEVELOPMENT PLATFORM DETECTION ▸ React Native provides the Platform module for detecting run time environment, when only small tweaks are needed based on platform, and not a completely unique component. ▸ Platform.OS === “ios” 
 Platform.OS === “android” 1 var { Platform } = React; 2 3 var styles = StyleSheet.create({ 4 height: (Platform.OS === 'ios') ? 200 : 180 5 });
  • 14. TOOLING AND DEVELOPMENT PLATFORM DETECTION ▸ React Native provides the Platform module for detecting run time environment, when only small tweaks are needed based on platform, and not a completely unique component. ▸ Platform.Select 
 1 var Component = Platform.select({ 2 ios: () => require('ComponentIOS'), 3 android: () => require('ComponentAndroid') 4 }); 5 6 <Component /> 1 var { Platform } = React; 2 3 var styles = StyleSheet.create({ 4 container: { 5 flex: 1, 6 ...Platform.select({ 7 ios: { backgroundColor: 'red' }, 8 android: { backgroundColor: 'blue' } 9 }) 10 } 11 });
  • 16. STYLING YOUR REACT NATIVE APP STYLES ARE IMPLEMENTED WITH JAVASCRIPT ▸ React Native layout 1 var styles = StyleSheet.create({ 2 base: { 3 width: 38, 4 height: 38, 5 }, 6 background: { 7 backgroundColor: '#222222', 8 }, 9 active: { 10 borderWidth: 2, 11 borderColor: '#00ff00', 12 }, 13 });
  • 17. STYLING YOUR REACT NATIVE APP STYLES ARE IMPLEMENTED WITH JAVASCRIPT ▸ All React Native core components accept a `style` attribute ▸ Both a single value or an array of values (mimics `Object.assign` with the right-most values taking priority) 1 <Text style={styles.base} /> 2 <View style={styles.background} /> 3 4 <View style={[styles.base, styles.background]} /> 5 6 <View style={[styles.base, this.state.active && styles.active]} />
  • 18. STYLING YOUR REACT NATIVE APP STYLES CAN BE PASSED AROUND AS PROPS 1 var List = React.createClass({ 2 propTypes: { 3 style: View.propTypes.style, 4 elementStyle: View.propTypes.style, 5 }, 6 render: function() { 7 return ( 8 <View style={this.props.style}> 9 {elements.map((element) => 10 <View style={[styles.element, this.props.elementStyle]} /> 11 )} 12 </View> 13 ); 14 } 15 }); 16 17 // ... in another file ... 18 <List style={styles.list} elementStyle={styles.listElement} />
  • 20. YEAH, SO HAVE FUN WITH THAT… Craig P Jolicoeur APP DEPLOYMENT
  • 22. RECOMMENDATIONS SINGLE MAIN APP ENTRY POINT ▸ Use a single `app.jsx` file as your main entry point instead of maintaining both `index.ios.js` and `index.android.js` 1 // index.{ios,android}.js 2 import { AppRegistry } from 'react-native'; 3 import App from './app'; 4 5 AppRegistry.registerComponent('MyApp', () => App); 6 7 // app.js 8 import React from 'react-native'; 9 import { Provider } from 'react-redux'; 10 import AppLoader from './components/app_loader'; 11 import ReduxStore from './redux/store'; 12 13 const MyApp = () => ( 14 <Provider store={ReduxStore.store()}> 15 <AppLoader /> 16 </Provider> 17 ); 18 19 export default MyApp;
  • 23. RECOMMENDATIONS INTEGRATE FABRIC.IO ▸ Setup on Fabric (Crashlytics) as a custom logger in both iOS and Android ▸ https://get.fabric.io/ ▸ https://github.com/corymsmith/react-native-fabric ▸ https://medium.com/delivery-com-engineering/add-crashlytics- to-your-react-native-ios-app-69a983a9062a#.35n80bfig ▸ (Android blog post to follow)
  • 24. RECOMMENDATIONS GENYMOTION ▸ Use the Genymotion Android Emulator for speed improvements. ▸ The newer Android Studio 2.0+ emulator is much better than it’s predecessor for native application dev (code hot-swapping, etc…) but still behind Genymotion for React Native development ▸ https://www.genymotion.com/
  • 26. RECOMMENDATIONS REACT-NATIVE-LOCALIZATION ▸ https://github.com/stefalda/ReactNativeLocalization ▸ https://www.npmjs.com/package/react-native-localization 1 import LocalizedStrings from 'react-native-localization'; 2 3 let strings = new LocalizedStrings({ 4 en:{ 5 how:"How do you want your egg today?", 6 boiledEgg:"Boiled egg" 7 }, 8 it: { 9 how:"Come vuoi il tuo uovo oggi?", 10 boiledEgg:"Uovo sodo" 11 } 12 }); 13 14 // In your component 15 <Text style={styles.title}>{strings.how}</Text> 1 import LocalizedStrings from 'react-native-localization'; 2 3 let strings = new LocalizedStrings({ 4 en:{ 5 bread: "bread", 6 butter: "butter", 7 question: "Would you like {0} and {1}, or just {0}?" 8 }, 9 ... 10 }); 11 12 // In your component 13 <Text style={styles.title}> 14 {strings.formatString(strings.question, strings.bread, strings.butter)} 15 </Text>
  • 31. PROS / CONS THE GOOD ▸ Single unified codebase (less knowledge required, fewer developers to maintain apps on two platforms) ▸ Single point of incoming errors/failures (only need to debug one codebase) ▸ Faster development time for teams without experienced Swift/Objective-C or Android SDK engineers ▸ Potential portability of components between mobile and web versions of the same React application
  • 32. PROS / CONS THE BAD (MAYBE) ▸ Can be harder to add custom components ▸ Not as much control over styling/graphics/animations as on a purely native platform ▸ Harder to profile performance and finely tune ▸ Not necessarily faster dev cycle then purely native applications. ▸ Project is still under heavy, active development and things “break” often between releases ▸ Debugging while developing is “unpleasant”
  • 34. EXTRA TOOLS PEPPERONI ▸ Pre-built boilerplate with features for login/authentication, messaging, push notifications, cloud-based backend, CodePush for direct app updates, etc… ▸ http://getpepperoni.com/
  • 35. EXTRA TOOLS CODEPUSH ▸ Open Source tool from Microsoft allowing you to push code updates to your app instantly for Cordova and React Native applications. ▸ http://microsoft.github.io/code-push/
  • 36. EXTRA TOOLS FASTLANE ▸ Automation done right (no really). Use this tool for native development, not only React Native. Ease of deployment, provisioning, certificate management, beta process, etc… ▸ https://fastlane.tools/
  • 37. EXTRA TOOLS RNPM ▸ React Native Package Manager built to ease your daily React Native development. Inspired by CocoaPods, Fastlane and react-native link ▸ https://github.com/rnpm/rnpm
  • 38. EXTRA TOOLS NUCLIDE ▸ React Native IDE built on top of Atom (by Facebook) ▸ Built in Chrome debugger, remote server access, Hack language support, etc… ▸ https://nuclide.io/
  • 39. EXTRA TOOLS DECO IDE ▸ React Native IDE (OS X only) ▸ Live visual feedback on updates, drag-and-drop component implementation, new file scaffold boilerplate ▸ https://github.com/decosoftware/deco-ide