SlideShare a Scribd company logo
Prof. Antonio S. Calanducci
20 May 2016
Prof. Antonio S. Calanducci
Corso di Laurea in Informatica, Unict
Anno accademico 2016/17
Laboratorio Avanzato di Programmazione II
Lesson 02: React & React Native
installation
Outline
Node.js
Atom / VSStudio Code
React
• Hello World in React DOM
Android SDK / iOS SDK
• (Optional) Install Genymotion
React Native
• Hello World in React Native
• Running and debugging on device
• create-react-native-app
• Expo
Node.js installation (Windows)
Several ways:
• (Windows) via Chocolatey (recommended)
• download from https://chocolatey.org
• choco	install	nodejs.install	
• choco	install	python2	
• (Windows) with Windows installer at:
• https://nodejs.org/en/download/
Node.js installation (Linux/macOS)
Several ways:
• with Node Version Manager (nvm):
• $	wget	-qO-	https://raw.githubusercontent.com/
creationix/nvm/v0.33.1/install.sh	|	bash	
• $	source	.profile	
• $	nvm	install	6	
• more info here: https://github.com/creationix/nvm#install-script
• via Package Manager:
• https://nodejs.org/en/download/package-manager/
• using a pre-built installer:
• https://nodejs.org/en/download/
Node.js installation (macOS)
Via Homebrew (the missing package
manger for macOS):
• $	/usr/bin/ruby	-e	"$(curl	-fsSL	
https://raw.githubusercontent.com/
Homebrew/install/master/install)”	
• $	brew	install	node	
• Info on Homebrew here: https://brew.sh
Install a Code Editor
Here my preferred ones:
• Atom (https://atom.io) - macOS/Win/Linux
• Visual Studio Code (https://
code.visualstudio.com) - macOS/Win/
Linux
• Sublime Text 3 (https://
www.sublimetext.com) - macOS/Win/Linux
Install React
If you want to just use React Native, you can skip this
Install React if you want to run React for Web (React.js)
and build awesome Single Page Web Application
• $	npm	install	-g	create-react-app	
• $	create-react-app	hello-world	
• $	cd	hello-world	
• $	npm	start	
https://facebook.github.io/react/docs/
installation.html
iOS SDK (macOS only)
Download and install Xcode
• from the Mac App Store
• https://itunes.apple.com/it/app/xcode/
id497799835?mt=12
• from https://developer.apple.com/
download/
Android SDK
easier way:
• install Android Studio
• https://developer.android.com/studio/index.html
• Choose custom install and select:
• Android SDK
• Android SDK Platform
• Performance (Intel ® HAXM)
• Android Virtual Device
harder way:
• Install just the SDK tools
• (link at the bottom of the previous page)
Configure Android SDK
Be sure to have Java JDK 8 installed
on Linux/macOS set JAVA_HOME to its path
from the Welcome screen of Android Studio, start the
SDK Manager and install Android 6.0 (Marshmallow):
• Google APIs
• Android SDK Platform 23
• Intel x86 Atom_64 System Image
• Google APIs Intel x86 Atom_64 System Image
Take note of where the Android SDK has been saved
Configure env (Linux/macOS)
Edit .profile or .bash_profile with
• export	ANDROID_HOME=${HOME}/
Library/Android/sdk	
• export	PATH=${PATH}:$
{ANDROID_HOME}/tools	
• export	PATH=${PATH}:$
{ANDROID_HOME}/platform-tools	
https://facebook.github.io/react-
native/docs/getting-started.html
Configure env (Windows)
https://facebook.github.io/react-native/
docs/getting-started.html
Configure and start an AVD
Android SDK comes with a built-in
emulator:
• from the AVD Manager (Android Studio),
create an AVD with
• Android 6.0 - API Level 23
• Intel Atom (x86_64)
• Start the AVD
Genymotion
Genymotion is a faster Android emulator
it’s free for educational purpose and personal
usage:
Download and install it from:
• https://www.genymotion.com/fun-zone/
You need to create a free account
VirtualBox is required
• so it cannot be run a virtualized host
React Native installation
Install React Native CLI with:
• $	npm	install	-g	react-native-cli	
Install Watchman:
• $	brew	install	watchman	(macOS)
• $	npm	install	-g	watchman	(Win /
Linux)
Hello World React Native
$	react-native	init	HelloWorld	
$	cd	HelloWorld	
$	react-native	run-ios	
$	react-native	run-android	
On Android an AVD (or Genymotion) should
be started manually
On macOS, the iOS Simulator is started
automatically
Running Hello World on devices
on macOS (iOS), you need to manually open Xcode and load the
HelloWorld.xcodeproj and run from Xcode
for Android:
• enable USB Debugging on your device.
• Connect it USB cable
• shutdown any emulator
Troubleshoting if the app won’t load:
• $ adb reverse tcp:8081 tcp:8081 (debugging via usb cable)
• 



https://facebook.github.io/react-native/docs/running-on-device.html
create-react-native-app
Create a React Native app on any OS with no build config
Test only on physical devices
No need to install Android Studio or Xcode
Can be used to develop for iOS even from Windows / Linux
Install it with:
• $	npm	install	-g	create-react-native-app	
Run with:
• $	create-react-native-app	my-app	
• cd	my-app/	
• npm	start	
Download and install Expo from https://expo.io
Expo and XDE
If you don’t want to use create-react-native-app
you can configure a react native skeleton with
XDE (Expo Development Environment)
• Download and install from:
• https://docs.expo.io/versions/v16.0.0/
introduction/installation.html
• Available for macOS / Windows / Linux
Use Expo apps on your iOS and Android
devices
Expo and Snack
if you don’t want to install anything on your
machine and learn React Native anyway, you
can use Snack at:
• https://snack.expo.io
Use Expo apps on your iOS and Android
devices
Linter (ESLint)
Code linting is a type of static analysis that is
frequently used to find problematic patterns or
code that doesn’t adhere to certain style
guidelines
• JavaScript, being a dynamic and loosely-
typed language, is especially prone to
developer error
• Linting tools like ESLint allow developers to
discover problems with their JavaScript code
without executing it
ESLint installation
Atom:
• packages to install: “linter”, “linter-
eslint”
Visual Studio Code
• npm	install	-g	eslint	
• extension to install: “ESLint”
ESLint configuration for React Native
npm	install	--save-dev	eslint-
config-rallycoding	
• PS: this config works only for React Native
project		
• Create a .eslintrc file into your project
root with the following content:
{	
		"extends":	"rallycoding"	
}
Questions

More Related Content

What's hot

Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)
Randal Schwartz
 
Intro to Ionic for Building Hybrid Mobile Applications
Intro to Ionic for Building Hybrid Mobile ApplicationsIntro to Ionic for Building Hybrid Mobile Applications
Intro to Ionic for Building Hybrid Mobile Applications
Sasha dos Santos
 
Flutter for web
Flutter for webFlutter for web
Flutter for web
rihannakedy
 
Mobile development with Flutter
Mobile development with FlutterMobile development with Flutter
Mobile development with Flutter
Awok
 
Mono for Android... for Google Devs
Mono for Android... for Google DevsMono for Android... for Google Devs
Mono for Android... for Google Devs
Craig Dunn
 
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
DevClub_lv
 
App forum2015 London - Building RhoMobile Applications with Ionic
App forum2015 London - Building RhoMobile Applications with IonicApp forum2015 London - Building RhoMobile Applications with Ionic
App forum2015 London - Building RhoMobile Applications with Ionic
robgalvinjr
 
Android studio
Android studioAndroid studio
Android studio
Željko Plesac
 
Hybrid Apps with Ionic Framework
Hybrid Apps with Ionic FrameworkHybrid Apps with Ionic Framework
Hybrid Apps with Ionic Framework
Bramus Van Damme
 
Ionic Crash Course! Hack-a-ton SF
Ionic Crash Course! Hack-a-ton SFIonic Crash Course! Hack-a-ton SF
Ionic Crash Course! Hack-a-ton SF
Lukas Ruebbelke
 
Flutter 1
Flutter 1Flutter 1
Flutter 1
Warren Lin
 
App Inventor Primer
App Inventor PrimerApp Inventor Primer
App Inventor Primer
Owen Cutajar
 
Flutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by StepFlutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by Step
Chandramouli Biyyala
 
Getting Your Hooks into Cordova
Getting Your Hooks into CordovaGetting Your Hooks into Cordova
Getting Your Hooks into Cordova
ColdFusionConference
 
Flutter talkshow
Flutter talkshowFlutter talkshow
Flutter talkshow
Nhan Cao
 
Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)
Priyanka Tyagi
 
Flutter bus 2018
Flutter bus 2018Flutter bus 2018
Flutter bus 2018
Ahmed Abu Eldahab
 
Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studiobryan costanich
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
Bartosz Kosarzycki
 
Flutter festival - building ui's with flutter
Flutter festival - building ui's with flutterFlutter festival - building ui's with flutter
Flutter festival - building ui's with flutter
Apoorv Pandey
 

What's hot (20)

Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)Native mobile application development with Flutter (Dart)
Native mobile application development with Flutter (Dart)
 
Intro to Ionic for Building Hybrid Mobile Applications
Intro to Ionic for Building Hybrid Mobile ApplicationsIntro to Ionic for Building Hybrid Mobile Applications
Intro to Ionic for Building Hybrid Mobile Applications
 
Flutter for web
Flutter for webFlutter for web
Flutter for web
 
Mobile development with Flutter
Mobile development with FlutterMobile development with Flutter
Mobile development with Flutter
 
Mono for Android... for Google Devs
Mono for Android... for Google DevsMono for Android... for Google Devs
Mono for Android... for Google Devs
 
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
 
App forum2015 London - Building RhoMobile Applications with Ionic
App forum2015 London - Building RhoMobile Applications with IonicApp forum2015 London - Building RhoMobile Applications with Ionic
App forum2015 London - Building RhoMobile Applications with Ionic
 
Android studio
Android studioAndroid studio
Android studio
 
Hybrid Apps with Ionic Framework
Hybrid Apps with Ionic FrameworkHybrid Apps with Ionic Framework
Hybrid Apps with Ionic Framework
 
Ionic Crash Course! Hack-a-ton SF
Ionic Crash Course! Hack-a-ton SFIonic Crash Course! Hack-a-ton SF
Ionic Crash Course! Hack-a-ton SF
 
Flutter 1
Flutter 1Flutter 1
Flutter 1
 
App Inventor Primer
App Inventor PrimerApp Inventor Primer
App Inventor Primer
 
Flutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by StepFlutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by Step
 
Getting Your Hooks into Cordova
Getting Your Hooks into CordovaGetting Your Hooks into Cordova
Getting Your Hooks into Cordova
 
Flutter talkshow
Flutter talkshowFlutter talkshow
Flutter talkshow
 
Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)
 
Flutter bus 2018
Flutter bus 2018Flutter bus 2018
Flutter bus 2018
 
Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studio
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
 
Flutter festival - building ui's with flutter
Flutter festival - building ui's with flutterFlutter festival - building ui's with flutter
Flutter festival - building ui's with flutter
 

Similar to Lezione 02 React and React Native installation and Configuration

React native on windows
React native on windowsReact native on windows
React native on windows
Abdul Karim
 
Mobile app with cordova
Mobile app with cordovaMobile app with cordova
Mobile app with cordova
Candice Zhuang
 
Mobile app with cordova
Mobile app with cordovaMobile app with cordova
Mobile app with cordova
Yu-Hsuan Chuang
 
Installing iOS and Android Simulators on MacOSX
Installing iOS and Android Simulators on MacOSXInstalling iOS and Android Simulators on MacOSX
Installing iOS and Android Simulators on MacOSX
Ken Skistimas
 
NCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile AppsNCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile Apps
John M. Wargo
 
Droidcon uk2012 androvm
Droidcon uk2012 androvmDroidcon uk2012 androvm
Droidcon uk2012 androvm
dfages
 
Appium on mac platform
Appium on mac platformAppium on mac platform
Appium on mac platform
Muhammad Zbeedat
 
Tutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJSTutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJS
Philipp Burgmer
 
[Open southcode] ios testing with appium
[Open southcode] ios testing with appium[Open southcode] ios testing with appium
[Open southcode] ios testing with appium
Estefanía Fernández Muñoz
 
03 Beginning Android Application Development
03 Beginning Android Application Development03 Beginning Android Application Development
03 Beginning Android Application DevelopmentArief Gunawan
 
Develop android application with mono for android
Develop android application with mono for androidDevelop android application with mono for android
Develop android application with mono for androidNicko Satria Consulting
 
Android app upload
Android app uploadAndroid app upload
Mobile application and Game development
Mobile application and Game developmentMobile application and Game development
Mobile application and Game development
Women In Digital
 
Automation testing on ios platform using appium
Automation testing on ios platform using appiumAutomation testing on ios platform using appium
Automation testing on ios platform using appium
Ambreen Khan
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Opersys inc.
 
React Native
React NativeReact Native
React Native
Craig Jolicoeur
 
DevNet Associate : Python introduction
DevNet Associate : Python introductionDevNet Associate : Python introduction
DevNet Associate : Python introduction
Joel W. King
 
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...Paris Open Source Summit
 
Ayw android env_setup
Ayw android env_setupAyw android env_setup
Ayw android env_setuppbeerak
 
Angularjs Tutorial for Beginners
Angularjs Tutorial for BeginnersAngularjs Tutorial for Beginners
Angularjs Tutorial for Beginners
rajkamaltibacademy
 

Similar to Lezione 02 React and React Native installation and Configuration (20)

React native on windows
React native on windowsReact native on windows
React native on windows
 
Mobile app with cordova
Mobile app with cordovaMobile app with cordova
Mobile app with cordova
 
Mobile app with cordova
Mobile app with cordovaMobile app with cordova
Mobile app with cordova
 
Installing iOS and Android Simulators on MacOSX
Installing iOS and Android Simulators on MacOSXInstalling iOS and Android Simulators on MacOSX
Installing iOS and Android Simulators on MacOSX
 
NCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile AppsNCDevCon 2017 - Cross Platform Mobile Apps
NCDevCon 2017 - Cross Platform Mobile Apps
 
Droidcon uk2012 androvm
Droidcon uk2012 androvmDroidcon uk2012 androvm
Droidcon uk2012 androvm
 
Appium on mac platform
Appium on mac platformAppium on mac platform
Appium on mac platform
 
Tutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJSTutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJS
 
[Open southcode] ios testing with appium
[Open southcode] ios testing with appium[Open southcode] ios testing with appium
[Open southcode] ios testing with appium
 
03 Beginning Android Application Development
03 Beginning Android Application Development03 Beginning Android Application Development
03 Beginning Android Application Development
 
Develop android application with mono for android
Develop android application with mono for androidDevelop android application with mono for android
Develop android application with mono for android
 
Android app upload
Android app uploadAndroid app upload
Android app upload
 
Mobile application and Game development
Mobile application and Game developmentMobile application and Game development
Mobile application and Game development
 
Automation testing on ios platform using appium
Automation testing on ios platform using appiumAutomation testing on ios platform using appium
Automation testing on ios platform using appium
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
 
React Native
React NativeReact Native
React Native
 
DevNet Associate : Python introduction
DevNet Associate : Python introductionDevNet Associate : Python introduction
DevNet Associate : Python introduction
 
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
OWF12/PAUG Conf Days Alternative to google's android emulator, daniel fages, ...
 
Ayw android env_setup
Ayw android env_setupAyw android env_setup
Ayw android env_setup
 
Angularjs Tutorial for Beginners
Angularjs Tutorial for BeginnersAngularjs Tutorial for Beginners
Angularjs Tutorial for Beginners
 

More from University of Catania

Lezione 03 Introduzione a react
Lezione 03   Introduzione a reactLezione 03   Introduzione a react
Lezione 03 Introduzione a react
University of Catania
 
LAP 2 Lezione 8: Properties, Database, Media, Filesystem
LAP 2  Lezione 8: Properties, Database, Media, FilesystemLAP 2  Lezione 8: Properties, Database, Media, Filesystem
LAP 2 Lezione 8: Properties, Database, Media, Filesystem
University of Catania
 
Laboratorio Creare e pubblicare mobile apps per iOS e Android Configurazione ...
Laboratorio Creare e pubblicare mobile apps per iOS e Android Configurazione ...Laboratorio Creare e pubblicare mobile apps per iOS e Android Configurazione ...
Laboratorio Creare e pubblicare mobile apps per iOS e Android Configurazione ...
University of Catania
 
Sistemi lezione-iv-internet-e-posta-elettronica
Sistemi lezione-iv-internet-e-posta-elettronicaSistemi lezione-iv-internet-e-posta-elettronica
Sistemi lezione-iv-internet-e-posta-elettronicaUniversity of Catania
 
Sistemi lezione-iii-reti-di-calcolatori
Sistemi lezione-iii-reti-di-calcolatoriSistemi lezione-iii-reti-di-calcolatori
Sistemi lezione-iii-reti-di-calcolatoriUniversity of Catania
 
Sistemi - Lezione XIV - Introduzione a HTML
Sistemi - Lezione XIV - Introduzione a HTMLSistemi - Lezione XIV - Introduzione a HTML
Sistemi - Lezione XIV - Introduzione a HTMLUniversity of Catania
 
Sistemi - Lezione XIII - Blogs e Blogger
Sistemi - Lezione XIII - Blogs e BloggerSistemi - Lezione XIII - Blogs e Blogger
Sistemi - Lezione XIII - Blogs e BloggerUniversity of Catania
 
Corso manzoni lezione 1-2-3
Corso manzoni   lezione 1-2-3Corso manzoni   lezione 1-2-3
Corso manzoni lezione 1-2-3
University of Catania
 
Sistemi lezione i - Presentazione - hardware
Sistemi   lezione i - Presentazione - hardwareSistemi   lezione i - Presentazione - hardware
Sistemi lezione i - Presentazione - hardwareUniversity of Catania
 
Sistemi lezione viii - google altri servizi
Sistemi   lezione viii - google altri serviziSistemi   lezione viii - google altri servizi
Sistemi lezione viii - google altri serviziUniversity of Catania
 
Sistemi lezione xi - picasa web album - social bookmarking - notizie 2
Sistemi   lezione xi - picasa web album - social bookmarking - notizie 2Sistemi   lezione xi - picasa web album - social bookmarking - notizie 2
Sistemi lezione xi - picasa web album - social bookmarking - notizie 2
University of Catania
 
Sistemi lezione x - introduzione al web 2.0 - flickr
Sistemi   lezione x - introduzione al web 2.0 - flickrSistemi   lezione x - introduzione al web 2.0 - flickr
Sistemi lezione x - introduzione al web 2.0 - flickrUniversity of Catania
 
Sistemi di elaborazione dell'informazione - Google Docs basics
Sistemi di elaborazione dell'informazione - Google Docs basicsSistemi di elaborazione dell'informazione - Google Docs basics
Sistemi di elaborazione dell'informazione - Google Docs basics
University of Catania
 

More from University of Catania (16)

Lezione 03 Introduzione a react
Lezione 03   Introduzione a reactLezione 03   Introduzione a react
Lezione 03 Introduzione a react
 
LAP 2 Lezione 8: Properties, Database, Media, Filesystem
LAP 2  Lezione 8: Properties, Database, Media, FilesystemLAP 2  Lezione 8: Properties, Database, Media, Filesystem
LAP 2 Lezione 8: Properties, Database, Media, Filesystem
 
Laboratorio Creare e pubblicare mobile apps per iOS e Android Configurazione ...
Laboratorio Creare e pubblicare mobile apps per iOS e Android Configurazione ...Laboratorio Creare e pubblicare mobile apps per iOS e Android Configurazione ...
Laboratorio Creare e pubblicare mobile apps per iOS e Android Configurazione ...
 
Sistemi lezione-v-google-web-search
Sistemi lezione-v-google-web-searchSistemi lezione-v-google-web-search
Sistemi lezione-v-google-web-search
 
Sistemi lezione-iv-internet-e-posta-elettronica
Sistemi lezione-iv-internet-e-posta-elettronicaSistemi lezione-iv-internet-e-posta-elettronica
Sistemi lezione-iv-internet-e-posta-elettronica
 
Sistemi lezione-iii-reti-di-calcolatori
Sistemi lezione-iii-reti-di-calcolatoriSistemi lezione-iii-reti-di-calcolatori
Sistemi lezione-iii-reti-di-calcolatori
 
Sistemi lezione-ii
Sistemi lezione-iiSistemi lezione-ii
Sistemi lezione-ii
 
Sistemi lezione xv - cenni su css
Sistemi   lezione xv - cenni su cssSistemi   lezione xv - cenni su css
Sistemi lezione xv - cenni su css
 
Sistemi - Lezione XIV - Introduzione a HTML
Sistemi - Lezione XIV - Introduzione a HTMLSistemi - Lezione XIV - Introduzione a HTML
Sistemi - Lezione XIV - Introduzione a HTML
 
Sistemi - Lezione XIII - Blogs e Blogger
Sistemi - Lezione XIII - Blogs e BloggerSistemi - Lezione XIII - Blogs e Blogger
Sistemi - Lezione XIII - Blogs e Blogger
 
Corso manzoni lezione 1-2-3
Corso manzoni   lezione 1-2-3Corso manzoni   lezione 1-2-3
Corso manzoni lezione 1-2-3
 
Sistemi lezione i - Presentazione - hardware
Sistemi   lezione i - Presentazione - hardwareSistemi   lezione i - Presentazione - hardware
Sistemi lezione i - Presentazione - hardware
 
Sistemi lezione viii - google altri servizi
Sistemi   lezione viii - google altri serviziSistemi   lezione viii - google altri servizi
Sistemi lezione viii - google altri servizi
 
Sistemi lezione xi - picasa web album - social bookmarking - notizie 2
Sistemi   lezione xi - picasa web album - social bookmarking - notizie 2Sistemi   lezione xi - picasa web album - social bookmarking - notizie 2
Sistemi lezione xi - picasa web album - social bookmarking - notizie 2
 
Sistemi lezione x - introduzione al web 2.0 - flickr
Sistemi   lezione x - introduzione al web 2.0 - flickrSistemi   lezione x - introduzione al web 2.0 - flickr
Sistemi lezione x - introduzione al web 2.0 - flickr
 
Sistemi di elaborazione dell'informazione - Google Docs basics
Sistemi di elaborazione dell'informazione - Google Docs basicsSistemi di elaborazione dell'informazione - Google Docs basics
Sistemi di elaborazione dell'informazione - Google Docs basics
 

Recently uploaded

addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 

Recently uploaded (20)

addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 

Lezione 02 React and React Native installation and Configuration

  • 1. Prof. Antonio S. Calanducci 20 May 2016 Prof. Antonio S. Calanducci Corso di Laurea in Informatica, Unict Anno accademico 2016/17 Laboratorio Avanzato di Programmazione II Lesson 02: React & React Native installation
  • 2. Outline Node.js Atom / VSStudio Code React • Hello World in React DOM Android SDK / iOS SDK • (Optional) Install Genymotion React Native • Hello World in React Native • Running and debugging on device • create-react-native-app • Expo
  • 3. Node.js installation (Windows) Several ways: • (Windows) via Chocolatey (recommended) • download from https://chocolatey.org • choco install nodejs.install • choco install python2 • (Windows) with Windows installer at: • https://nodejs.org/en/download/
  • 4. Node.js installation (Linux/macOS) Several ways: • with Node Version Manager (nvm): • $ wget -qO- https://raw.githubusercontent.com/ creationix/nvm/v0.33.1/install.sh | bash • $ source .profile • $ nvm install 6 • more info here: https://github.com/creationix/nvm#install-script • via Package Manager: • https://nodejs.org/en/download/package-manager/ • using a pre-built installer: • https://nodejs.org/en/download/
  • 5. Node.js installation (macOS) Via Homebrew (the missing package manger for macOS): • $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/ Homebrew/install/master/install)” • $ brew install node • Info on Homebrew here: https://brew.sh
  • 6. Install a Code Editor Here my preferred ones: • Atom (https://atom.io) - macOS/Win/Linux • Visual Studio Code (https:// code.visualstudio.com) - macOS/Win/ Linux • Sublime Text 3 (https:// www.sublimetext.com) - macOS/Win/Linux
  • 7. Install React If you want to just use React Native, you can skip this Install React if you want to run React for Web (React.js) and build awesome Single Page Web Application • $ npm install -g create-react-app • $ create-react-app hello-world • $ cd hello-world • $ npm start https://facebook.github.io/react/docs/ installation.html
  • 8. iOS SDK (macOS only) Download and install Xcode • from the Mac App Store • https://itunes.apple.com/it/app/xcode/ id497799835?mt=12 • from https://developer.apple.com/ download/
  • 9. Android SDK easier way: • install Android Studio • https://developer.android.com/studio/index.html • Choose custom install and select: • Android SDK • Android SDK Platform • Performance (Intel ® HAXM) • Android Virtual Device harder way: • Install just the SDK tools • (link at the bottom of the previous page)
  • 10. Configure Android SDK Be sure to have Java JDK 8 installed on Linux/macOS set JAVA_HOME to its path from the Welcome screen of Android Studio, start the SDK Manager and install Android 6.0 (Marshmallow): • Google APIs • Android SDK Platform 23 • Intel x86 Atom_64 System Image • Google APIs Intel x86 Atom_64 System Image Take note of where the Android SDK has been saved
  • 11. Configure env (Linux/macOS) Edit .profile or .bash_profile with • export ANDROID_HOME=${HOME}/ Library/Android/sdk • export PATH=${PATH}:$ {ANDROID_HOME}/tools • export PATH=${PATH}:$ {ANDROID_HOME}/platform-tools https://facebook.github.io/react- native/docs/getting-started.html
  • 13. Configure and start an AVD Android SDK comes with a built-in emulator: • from the AVD Manager (Android Studio), create an AVD with • Android 6.0 - API Level 23 • Intel Atom (x86_64) • Start the AVD
  • 14. Genymotion Genymotion is a faster Android emulator it’s free for educational purpose and personal usage: Download and install it from: • https://www.genymotion.com/fun-zone/ You need to create a free account VirtualBox is required • so it cannot be run a virtualized host
  • 15. React Native installation Install React Native CLI with: • $ npm install -g react-native-cli Install Watchman: • $ brew install watchman (macOS) • $ npm install -g watchman (Win / Linux)
  • 16. Hello World React Native $ react-native init HelloWorld $ cd HelloWorld $ react-native run-ios $ react-native run-android On Android an AVD (or Genymotion) should be started manually On macOS, the iOS Simulator is started automatically
  • 17. Running Hello World on devices on macOS (iOS), you need to manually open Xcode and load the HelloWorld.xcodeproj and run from Xcode for Android: • enable USB Debugging on your device. • Connect it USB cable • shutdown any emulator Troubleshoting if the app won’t load: • $ adb reverse tcp:8081 tcp:8081 (debugging via usb cable) • 
 
 https://facebook.github.io/react-native/docs/running-on-device.html
  • 18. create-react-native-app Create a React Native app on any OS with no build config Test only on physical devices No need to install Android Studio or Xcode Can be used to develop for iOS even from Windows / Linux Install it with: • $ npm install -g create-react-native-app Run with: • $ create-react-native-app my-app • cd my-app/ • npm start Download and install Expo from https://expo.io
  • 19. Expo and XDE If you don’t want to use create-react-native-app you can configure a react native skeleton with XDE (Expo Development Environment) • Download and install from: • https://docs.expo.io/versions/v16.0.0/ introduction/installation.html • Available for macOS / Windows / Linux Use Expo apps on your iOS and Android devices
  • 20. Expo and Snack if you don’t want to install anything on your machine and learn React Native anyway, you can use Snack at: • https://snack.expo.io Use Expo apps on your iOS and Android devices
  • 21. Linter (ESLint) Code linting is a type of static analysis that is frequently used to find problematic patterns or code that doesn’t adhere to certain style guidelines • JavaScript, being a dynamic and loosely- typed language, is especially prone to developer error • Linting tools like ESLint allow developers to discover problems with their JavaScript code without executing it
  • 22. ESLint installation Atom: • packages to install: “linter”, “linter- eslint” Visual Studio Code • npm install -g eslint • extension to install: “ESLint”
  • 23. ESLint configuration for React Native npm install --save-dev eslint- config-rallycoding • PS: this config works only for React Native project • Create a .eslintrc file into your project root with the following content: { "extends": "rallycoding" }