SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
Burn your grass with React Native
Eugene Zharkov
Frontend Developer
Release Cycle
• 0.49 - September (289 commits)

• 0.48 - September (526 commits)

• 0.47 - August (781 commits)

• 0.46 - July (977 commits)

• 0.45 - June (1325 commits)

• 0.44 - May (1731 commits)

• 0.43 - April (2134 commits)

• 0.42 - March (2487 commits)

• 0.41 - January (2777 commits)

• 0.41 - December (3243 commits)
Styles: Almost CSS
cardIconText: {
color: '#fff',
fontSize: 14,
fontWeight: '600',
letterSpacing: 0.8
},
testDriveLine: {
borderTopWidth: 1,
borderTopColor: '#31353F',
marginTop: 40
},
testDriveActions: {
justifyContent: 'center',
alignItems: 'center',
marginVertical: 16
}
firstName: {
fontSize: 17,
backgroundColor: '#fff',
borderColor: '#acb2b8',
borderRadius: 5,
borderWidth: 1,
paddingVertical: 18,
paddingHorizontal: 16,
marginTop: 30,
marginBottom: 12,
width: '100%',
}
borderStyle: 'solid'
borderWidth: 1
borderColor: ‘#acb2b8’
CSS
React Native CSS
border: solid 1px #acb2b8
Styles: Almost CSS
• Никакого наследования, комбинаторов, псевдо
классов -> только спагетти

• Нехватка кратких свойств border: 5px solid red
github/react-native-styling-cheat-sheet
Extended Styles
• styled-components/css-to-react-native

• pjjanak/react-native-nested-stylesheets

• sabeurthabti/react-native-css

• jspears/postcss-react-native
Layout: Flex
buttons: {
flex: 1,
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
}
Layout: Markup
<ScrollView
contentContainerStyle={ styles.container }>
<View style={ styles.photoRow }>
<TouchableHighlight
style={ styles.photoWrapper }
onPress={ this.onAvatarPress }>
<Image style={ avatarStyle }
source={ avatarSource } "/>
"</TouchableHighlight>
"</View>
"</ScrollView>
Platform Specific
<TextInput
style={ styles.textInput }
maxLength={ 10 }
blurOnSubmit={ false }
returnKeyType={ "next" }
caretHidden
autoFocus={ num "== 0 "&& this.props.autoFocus }
autoCorrect={ false }
spellCheck={false}
clearTextOnFocus={false}
underlineColorAndroid="transparent"
numberOfLines={2}
autoGrow={true}
keyboardType="numeric"
ref={ input "=> {
this.inputs[num] = input;
}}
onChangeText={ (text) "=> this.onChange(num, text) }
onSubmitEditing={() "=> {
this.focusNextField(num + 1);
}}
"/>
Platform Specific
spellCheck={false}
clearTextOnFocus={false}
underlineColorAndroid="transparent"
numberOfLines={2}
autoGrow={true}
keyboardType="numeric"
Partially
Platform Specific
import { Platform} from 'react-native';
or

Component.ios.js
Component.android.js
import Component from ‘Component';
Application
Fast Start
> npm install -g create-react-native-app
> create-react-native-app my-app
> cd my-app/
> npm start
Component Integration
> npm install react-native-fingerprint-scanner —save
> react-native link react-native-fingerprint-scanner
Happy Way
Component Integration
iOS
	 1	 In XCode, in the project navigator, right click Libraries ➜ Add	Files	to	[your	project's	name]

	 2	 Go to node_modules ➜ react-native-fingerprint-scanner and add ReactNativeFingerprintScanner.xcodeproj

	 3	 In XCode, in the project navigator, select your project. Add libReactNativeFingerprintScanner.a to your project's
Build	Phases ➜ Link	Binary	With	Libraries

	 4	 Run your project (Cmd+R)

Android
	 1	 Open up android/app/src/main/java/[...]/MainActivity.java

	 •	 Add import	com.hieuvp.fingerprint.ReactNativeFingerprintScannerPackage; to the imports at the top of the file

	 •	 Add new	ReactNativeFingerprintScannerPackage() to the list returned by the getPackages() method

	 2	 Append the following lines to android/settings.gradle: include	':react-native-fingerprint-scanner'	
	 3	 project(':react-native-fingerprint-scanner').projectDir	=	new	File(rootProject.projectDir,	'../node_modules/
react-native-fingerprint-scanner/android')	
	 4	 

	 5	 Insert the following lines inside the dependencies block in android/app/build.gradle: compile	project(':react-
native-fingerprint-scanner')
Real Way
Component Integration
Android Installation
!> Make sure you are using react-native version >= 0.43. We also recommend using npm version >= 3

	 1	 Install react-native-navigation latest stable version.

yarn	add	react-native-navigation@latest

	 2	 Add the following in android/settings.gradle.

include	':react-native-navigation'	
	 3	 project(':react-native-navigation').projectDir	=	new	File(rootProject.projectDir,	'../node_modules/react-native-navigation/android/app/')

	 4	 Update project dependencies in android/app/build.gradle.

android	{	
	 5	 	 compileSdkVersion	25	
	 6	 	 buildToolsVersion	"25.0.1"	
	 7	 	 ...	
	 8	 }	
	 9	 	
	 10	 dependencies	{	
	 11	 	 compile	fileTree(dir:	"libs",	include:	["*.jar"])	
	 12	 	 compile	"com.android.support:appcompat-v7:23.0.1"	
	 13	 	 compile	"com.facebook.react:react-native:+"	
	 14	 	 compile	project(':react-native-navigation')	
	 15	 }

	 16	 In MainActivity.java it should extend com.reactnativenavigation.controllers.SplashActivity instead of ReactActivity.

This file can be located in android/app/src/main/java/com/yourproject/.

import	com.reactnativenavigation.controllers.SplashActivity;	
	 17	 	
	 18	 public	class	MainActivity	extends	SplashActivity	{	
	 19	 	
	 20	 }



If you have any react-native related methods, you can safely delete them.

	 21	 In MainApplication.java, add the following

import	com.reactnativenavigation.NavigationApplication;	
	 22	 	
	 23	 public	class	MainApplication	extends	NavigationApplication	{	
	 24	 	
	 25	 	 @Override	
	 26	 	 public	boolean	isDebug()	{	
	 27	 	 	 //	Make	sure	you	are	using	BuildConfig	from	your	own	application	
	 28	 	 	 return	BuildConfig.DEBUG;	
	 29	 	 }	
	 30	 	
	 31	 	 protected	List<ReactPackage>	getPackages()	{	
	 32	 	 	 //	Add	additional	packages	you	require	here	
	 33	 	 	 //	No	need	to	add	RnnPackage	and	MainReactPackage	
	 34	 	 	 return	Arrays.<ReactPackage>asList(	
	 35	 	 	 	 //	eg.	new	VectorIconsPackage()	
	 36	 	 	 );	
	 37	 	 }	
	 38	 	
	 39	 	 @Override	
	 40	 	 public	List<ReactPackage>	createAdditionalReactPackages()	{	
	 41	 	 	 return	getPackages();	
	 42	 	 }	
	 43	 }



Make sure that isDebug and createAdditionalReactPackages methods are implemented.

	 44	 Update AndroidManifest.xml and set android:name value to .MainApplication

<application	
	 45	 	 android:name=".MainApplication"	
	 46	 	 ...	
	 47	 />
Real Way
What are the limitations of Create React Native App?
The main limitation of a Create React Native App project
is that it must be written in pure JavaScript and not
have any dependencies which rely on custom native code
(i.e. ones which require running react-native link to
work).
Versions Compatibility
Navigation
• ReactTraining/react-router (JS)

• react-community/react-navigation (JS)

• wix/react-native-navigation (native)

• airbnb/native-navigation (native)
WIX / react-native-navigation
Navigation / Registration
import { Navigation } from ‘react-native-navigation';
Navigation.registerComponent('pilot.Auth', () "=> Auth);
or with Redux:
Navigation.registerComponent('pilot.Auth', () "=> Auth,
store, Provider);
Navigation / Start
Storage.isUserExist()
.then(exist "=> {
const startScreen = exist ? 'pilot.Auth' :
‘pilot.CreateProfile';
Navigation.startSingleScreenApp({
screen: {
screen: startScreen
}
});
});
Navigation / Go to
this.props.navigator.push({
screen: 'pilot.CreateProfile.UserInfo',
backButtonTitle: '',
passProps: {
phone: this.props.phone,
pin: this.state.code,
authType
}
});
Debug
• Chrome Developer Tools

• facebook/react-devtools

• jhen0409/react-native-debugger
Animation Demo
Build / Deploy
Get used to Xcode
Get used to Android Studio
Knowledge Bottlenecks
• Test simultaneously iOS / Android

• Library Integration beyond react-native link

• Fix library compatibility with latest react-native version

• Learn a bit about Swift / Java

• Setup iOS / Android build / deploy
Which Caused Wrong Estimates
Estimated: 10 days
Real: 16 days
Difference: 50-60%
Gracias!
@2j2e
eu.zharkov@gmail.com

Contenu connexe

Tendances

Tendances (20)

Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
Sbt Concepts - Tips, Tricks, Sandbox, ... 02/2013
 
Using the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM DevelopmentUsing the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM Development
 
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
 
Load Testing with k6 framework
Load Testing with k6 frameworkLoad Testing with k6 framework
Load Testing with k6 framework
 
Grails plugin development
Grails plugin developmentGrails plugin development
Grails plugin development
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang
 
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionCool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
 
Introduction to Powershell Version 5
Introduction to Powershell Version 5Introduction to Powershell Version 5
Introduction to Powershell Version 5
 
Automate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon ViennaAutomate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon Vienna
 
PyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsPyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web Applications
 
PuppetConf 2016: Getting to the Latest Puppet – Nate McCurdy & Elizabeth Witt...
PuppetConf 2016: Getting to the Latest Puppet – Nate McCurdy & Elizabeth Witt...PuppetConf 2016: Getting to the Latest Puppet – Nate McCurdy & Elizabeth Witt...
PuppetConf 2016: Getting to the Latest Puppet – Nate McCurdy & Elizabeth Witt...
 
Kubernetes workshop -_the_basics
Kubernetes workshop -_the_basicsKubernetes workshop -_the_basics
Kubernetes workshop -_the_basics
 
Custom plugin
Custom pluginCustom plugin
Custom plugin
 
Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)Salesforce Developer eXperience (SFDX)
Salesforce Developer eXperience (SFDX)
 
Gradle in a Polyglot World
Gradle in a Polyglot WorldGradle in a Polyglot World
Gradle in a Polyglot World
 
SFDX - Spring 2019 Update
SFDX - Spring 2019 UpdateSFDX - Spring 2019 Update
SFDX - Spring 2019 Update
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Android development with Scala and SBT
Android development with Scala and SBTAndroid development with Scala and SBT
Android development with Scala and SBT
 
Groovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web ApplicationsGroovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web Applications
 
Lightweight Developer Provisioning with Gradle and SEU-as-code
Lightweight Developer Provisioning with Gradle and SEU-as-codeLightweight Developer Provisioning with Gradle and SEU-as-code
Lightweight Developer Provisioning with Gradle and SEU-as-code
 

Similaire à Burn your grass with react native

Similaire à Burn your grass with react native (20)

Евгений Жарков "React Native: Hurdle Race"
Евгений Жарков "React Native: Hurdle Race"Евгений Жарков "React Native: Hurdle Race"
Евгений Жарков "React Native: Hurdle Race"
 
React Native: Hurdle Race
React Native: Hurdle RaceReact Native: Hurdle Race
React Native: Hurdle Race
 
React inter3
React inter3React inter3
React inter3
 
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
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
Excelian hyperledger walkthrough-feb17
Excelian hyperledger walkthrough-feb17Excelian hyperledger walkthrough-feb17
Excelian hyperledger walkthrough-feb17
 
JavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and FutureJavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and Future
 
React Native
React NativeReact Native
React Native
 
To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016
To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016
To ∞ (~65K) and beyond! - Sebastiano Gottardo - Codemotion Milan 2016
 
Everything as a Code / Александр Тарасов (Одноклассники)
Everything as a Code / Александр Тарасов (Одноклассники)Everything as a Code / Александр Тарасов (Одноклассники)
Everything as a Code / Александр Тарасов (Одноклассники)
 
Need 4 Speed FI
Need 4 Speed FINeed 4 Speed FI
Need 4 Speed FI
 
Microservices DevOps on Google Cloud Platform
Microservices DevOps on Google Cloud PlatformMicroservices DevOps on Google Cloud Platform
Microservices DevOps on Google Cloud Platform
 
From Zero to Hero - All you need to do serious deep learning stuff in R
From Zero to Hero - All you need to do serious deep learning stuff in R From Zero to Hero - All you need to do serious deep learning stuff in R
From Zero to Hero - All you need to do serious deep learning stuff in R
 
React nativebeginner1
React nativebeginner1React nativebeginner1
React nativebeginner1
 
reactjs-quiz..docs.pdf
reactjs-quiz..docs.pdfreactjs-quiz..docs.pdf
reactjs-quiz..docs.pdf
 
manual
manualmanual
manual
 
manual
manualmanual
manual
 
Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdf
 
Devtools cheatsheet
Devtools cheatsheetDevtools cheatsheet
Devtools cheatsheet
 
Devtools cheatsheet
Devtools cheatsheetDevtools cheatsheet
Devtools cheatsheet
 

Plus de Eugene Zharkov

Angular 2.0: Brighter future?
Angular 2.0: Brighter future?Angular 2.0: Brighter future?
Angular 2.0: Brighter future?
Eugene Zharkov
 
SignalR: Add real-time to your applications
SignalR: Add real-time to your applicationsSignalR: Add real-time to your applications
SignalR: Add real-time to your applications
Eugene Zharkov
 
Roslyn compiler as a service
Roslyn compiler as a serviceRoslyn compiler as a service
Roslyn compiler as a service
Eugene Zharkov
 

Plus de Eugene Zharkov (20)

Monorepo: React + React Native. React Alicante
Monorepo:  React + React Native. React Alicante Monorepo:  React + React Native. React Alicante
Monorepo: React + React Native. React Alicante
 
Monorepo: React Web & React Native
Monorepo: React Web & React NativeMonorepo: React Web & React Native
Monorepo: React Web & React Native
 
Create React Native App vs Expo vs Manually
Create React Native App vs Expo vs ManuallyCreate React Native App vs Expo vs Manually
Create React Native App vs Expo vs Manually
 
Build automation with Fastlane
Build automation with FastlaneBuild automation with Fastlane
Build automation with Fastlane
 
GraphQL and/or REST
GraphQL and/or RESTGraphQL and/or REST
GraphQL and/or REST
 
React Native Animation
React Native AnimationReact Native Animation
React Native Animation
 
Фронтенд сказки
Фронтенд сказкиФронтенд сказки
Фронтенд сказки
 
How to be a good frontend developer
How to be a good frontend developerHow to be a good frontend developer
How to be a good frontend developer
 
Cycle.js: Functional and Reactive
Cycle.js: Functional and ReactiveCycle.js: Functional and Reactive
Cycle.js: Functional and Reactive
 
Что там в summary
Что там в summaryЧто там в summary
Что там в summary
 
Elm: give it a try
Elm: give it a tryElm: give it a try
Elm: give it a try
 
Switch to React.js from AngularJS developer
Switch to React.js from AngularJS developerSwitch to React.js from AngularJS developer
Switch to React.js from AngularJS developer
 
AngularJS: Good parts
AngularJS: Good partsAngularJS: Good parts
AngularJS: Good parts
 
Mobile applications in a new way with React Native
Mobile applications in a new way with React NativeMobile applications in a new way with React Native
Mobile applications in a new way with React Native
 
Angular 2: Всех переиграл
Angular 2: Всех переигралAngular 2: Всех переиграл
Angular 2: Всех переиграл
 
Angular 2.0: Brighter future?
Angular 2.0: Brighter future?Angular 2.0: Brighter future?
Angular 2.0: Brighter future?
 
Как объяснить на платьях процесс разработки?
Как объяснить на платьях процесс разработки?Как объяснить на платьях процесс разработки?
Как объяснить на платьях процесс разработки?
 
Angular.JS: Do it right
Angular.JS: Do it rightAngular.JS: Do it right
Angular.JS: Do it right
 
SignalR: Add real-time to your applications
SignalR: Add real-time to your applicationsSignalR: Add real-time to your applications
SignalR: Add real-time to your applications
 
Roslyn compiler as a service
Roslyn compiler as a serviceRoslyn compiler as a service
Roslyn compiler as a service
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Burn your grass with react native

  • 1. Burn your grass with React Native Eugene Zharkov Frontend Developer
  • 2.
  • 3.
  • 4. Release Cycle • 0.49 - September (289 commits) • 0.48 - September (526 commits) • 0.47 - August (781 commits) • 0.46 - July (977 commits) • 0.45 - June (1325 commits) • 0.44 - May (1731 commits) • 0.43 - April (2134 commits) • 0.42 - March (2487 commits) • 0.41 - January (2777 commits) • 0.41 - December (3243 commits)
  • 5. Styles: Almost CSS cardIconText: { color: '#fff', fontSize: 14, fontWeight: '600', letterSpacing: 0.8 }, testDriveLine: { borderTopWidth: 1, borderTopColor: '#31353F', marginTop: 40 }, testDriveActions: { justifyContent: 'center', alignItems: 'center', marginVertical: 16 } firstName: { fontSize: 17, backgroundColor: '#fff', borderColor: '#acb2b8', borderRadius: 5, borderWidth: 1, paddingVertical: 18, paddingHorizontal: 16, marginTop: 30, marginBottom: 12, width: '100%', }
  • 6. borderStyle: 'solid' borderWidth: 1 borderColor: ‘#acb2b8’ CSS React Native CSS border: solid 1px #acb2b8
  • 7. Styles: Almost CSS • Никакого наследования, комбинаторов, псевдо классов -> только спагетти • Нехватка кратких свойств border: 5px solid red github/react-native-styling-cheat-sheet
  • 8. Extended Styles • styled-components/css-to-react-native • pjjanak/react-native-nested-stylesheets • sabeurthabti/react-native-css • jspears/postcss-react-native
  • 9. Layout: Flex buttons: { flex: 1, flexDirection: 'row', justifyContent: 'space-around', alignItems: 'center', }
  • 10. Layout: Markup <ScrollView contentContainerStyle={ styles.container }> <View style={ styles.photoRow }> <TouchableHighlight style={ styles.photoWrapper } onPress={ this.onAvatarPress }> <Image style={ avatarStyle } source={ avatarSource } "/> "</TouchableHighlight> "</View> "</ScrollView>
  • 11. Platform Specific <TextInput style={ styles.textInput } maxLength={ 10 } blurOnSubmit={ false } returnKeyType={ "next" } caretHidden autoFocus={ num "== 0 "&& this.props.autoFocus } autoCorrect={ false } spellCheck={false} clearTextOnFocus={false} underlineColorAndroid="transparent" numberOfLines={2} autoGrow={true} keyboardType="numeric" ref={ input "=> { this.inputs[num] = input; }} onChangeText={ (text) "=> this.onChange(num, text) } onSubmitEditing={() "=> { this.focusNextField(num + 1); }} "/>
  • 13. Platform Specific import { Platform} from 'react-native'; or Component.ios.js Component.android.js import Component from ‘Component';
  • 15. Fast Start > npm install -g create-react-native-app > create-react-native-app my-app > cd my-app/ > npm start
  • 16. Component Integration > npm install react-native-fingerprint-scanner —save > react-native link react-native-fingerprint-scanner Happy Way
  • 17. Component Integration iOS 1 In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name] 2 Go to node_modules ➜ react-native-fingerprint-scanner and add ReactNativeFingerprintScanner.xcodeproj 3 In XCode, in the project navigator, select your project. Add libReactNativeFingerprintScanner.a to your project's Build Phases ➜ Link Binary With Libraries 4 Run your project (Cmd+R) Android 1 Open up android/app/src/main/java/[...]/MainActivity.java • Add import com.hieuvp.fingerprint.ReactNativeFingerprintScannerPackage; to the imports at the top of the file • Add new ReactNativeFingerprintScannerPackage() to the list returned by the getPackages() method 2 Append the following lines to android/settings.gradle: include ':react-native-fingerprint-scanner' 3 project(':react-native-fingerprint-scanner').projectDir = new File(rootProject.projectDir, '../node_modules/ react-native-fingerprint-scanner/android') 4 5 Insert the following lines inside the dependencies block in android/app/build.gradle: compile project(':react- native-fingerprint-scanner') Real Way
  • 18. Component Integration Android Installation !> Make sure you are using react-native version >= 0.43. We also recommend using npm version >= 3 1 Install react-native-navigation latest stable version.
 yarn add react-native-navigation@latest
 2 Add the following in android/settings.gradle.
 include ':react-native-navigation' 3 project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app/')
 4 Update project dependencies in android/app/build.gradle.
 android { 5 compileSdkVersion 25 6 buildToolsVersion "25.0.1" 7 ... 8 } 9 10 dependencies { 11 compile fileTree(dir: "libs", include: ["*.jar"]) 12 compile "com.android.support:appcompat-v7:23.0.1" 13 compile "com.facebook.react:react-native:+" 14 compile project(':react-native-navigation') 15 }
 16 In MainActivity.java it should extend com.reactnativenavigation.controllers.SplashActivity instead of ReactActivity.
 This file can be located in android/app/src/main/java/com/yourproject/.
 import com.reactnativenavigation.controllers.SplashActivity; 17 18 public class MainActivity extends SplashActivity { 19 20 }
 
 If you have any react-native related methods, you can safely delete them. 21 In MainApplication.java, add the following
 import com.reactnativenavigation.NavigationApplication; 22 23 public class MainApplication extends NavigationApplication { 24 25 @Override 26 public boolean isDebug() { 27 // Make sure you are using BuildConfig from your own application 28 return BuildConfig.DEBUG; 29 } 30 31 protected List<ReactPackage> getPackages() { 32 // Add additional packages you require here 33 // No need to add RnnPackage and MainReactPackage 34 return Arrays.<ReactPackage>asList( 35 // eg. new VectorIconsPackage() 36 ); 37 } 38 39 @Override 40 public List<ReactPackage> createAdditionalReactPackages() { 41 return getPackages(); 42 } 43 }
 
 Make sure that isDebug and createAdditionalReactPackages methods are implemented. 44 Update AndroidManifest.xml and set android:name value to .MainApplication
 <application 45 android:name=".MainApplication" 46 ... 47 /> Real Way
  • 19.
  • 20. What are the limitations of Create React Native App? The main limitation of a Create React Native App project is that it must be written in pure JavaScript and not have any dependencies which rely on custom native code (i.e. ones which require running react-native link to work).
  • 22. Navigation • ReactTraining/react-router (JS) • react-community/react-navigation (JS) • wix/react-native-navigation (native) • airbnb/native-navigation (native)
  • 24. Navigation / Registration import { Navigation } from ‘react-native-navigation'; Navigation.registerComponent('pilot.Auth', () "=> Auth); or with Redux: Navigation.registerComponent('pilot.Auth', () "=> Auth, store, Provider);
  • 25. Navigation / Start Storage.isUserExist() .then(exist "=> { const startScreen = exist ? 'pilot.Auth' : ‘pilot.CreateProfile'; Navigation.startSingleScreenApp({ screen: { screen: startScreen } }); });
  • 26. Navigation / Go to this.props.navigator.push({ screen: 'pilot.CreateProfile.UserInfo', backButtonTitle: '', passProps: { phone: this.props.phone, pin: this.state.code, authType } });
  • 27. Debug • Chrome Developer Tools • facebook/react-devtools • jhen0409/react-native-debugger
  • 30. Get used to Xcode
  • 31. Get used to Android Studio
  • 32. Knowledge Bottlenecks • Test simultaneously iOS / Android • Library Integration beyond react-native link • Fix library compatibility with latest react-native version • Learn a bit about Swift / Java • Setup iOS / Android build / deploy
  • 33. Which Caused Wrong Estimates Estimated: 10 days Real: 16 days Difference: 50-60%