SlideShare a Scribd company logo
React Native in Production
Build Native Mobile Apps using JavaScript and React
Kim Seokjun aka alma
Front-end web developer at SOCAR
Working as DevOps
- react.js, react-native, node.js, express.js, docker
Interested in
- go, tensorflow, functional programming
React.js React Native
React.js React Native
WHY REACT-NATIVE?
오늘부터 2차 모집중!
http://zerocar.socar.kr
WHY? 1. To avoid risk mixing
Single bug may affect two services
SOCAR is already huge and complex application
WHY? 2. Not much to share with SOCAR
ZEROCAR is running over SOCAR
but in behavioral standpoint it’s not
WHY? 3. Minimize features and quick updates
Feature list was too long for 3 weeks
So decided to spec out most and focus on criticals
WHY? 4. iOS and Android
Android
60%
iOS
40%
WHY? 5. React experienced web developer
OPTIONS
Cordova + React
NativeScript
React Native
PROS
PROS 1. It’s REACT!
React + Redux + ES6 = Awesome!
import { ScrollView } from ‘react-native’
import { Profile, SharingStatus, Scheduler } from ‘@components’
class HomeContainer extends React {
refresh() {
fetch(‘http://api.url).then((res) => this.props.getSharingStatus(res))
}
render() {
<ScrollView>
<Profile />
<SharingStatus />
<Scheduler />
</ScrollView>
}
}
PROS 2. FLEX Layout
CSS the good parts : Flex layout is very Flexible
<View style={{ flex: 1 }}>
<View style={{ flex: 1 }} />
<View style={{ flex: 1 }} />
<View style={{ height: 100 }} />
</View>
height: 100
flex: 1
flex: 1
Viewport
PROS 2. FLEX Layout
CSS the good parts : Flex layout is very Flexible
flex: 1 flex: 1
Viewport
<View style={{ height: 50,
flexDirection: ‘row’ }}>
<View style={{ flex: 1 }} />
<View style={{ flex: 1 }} />
</View>
height: 50
flexDirection: ‘row’
PROS 2. FLEX Layout
CSS the good parts : Flex layout is very Flexible
<View
style={{
justifyContent: ‘center’,
alignItems: ‘center’,
}}
>
<Text
style={{
width: 50,
}}
>
Centered
</Text>
</View>
Centered
Viewport
justifyContent: ‘center’
alignItems: ‘center’
PROS 3. No compile, Hot-reload
Thank you Dan!
I love you!
Really!
Love you!
My Jesus!
Dan Abramov, author of Redux and React Hot Reloader
PROS 4. The Javascript
Lodash
Moment.js
Accounting
PROS 4. The Javascript
Lodash : the functional programming
const getCamelCased = (text: string) => {
if (!text) return null;
return text.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
};
const getButtonStyle = (className) => {
if (!className) return null;
return _.chain(['btn', 'normal', ...className.split(/s/)])
.map(elem => styles[getCamelCased(elem)])
.value();
};
PROS 4. The Javascript
Moment : date-time eternal villain for developer
const getMinStartDate = (endDate) => {
if (endDate) return moment(endDate).subtract(120, 'minutes');
const now = moment();
const currentMinute = now.minute();
const currentSeconds = now.second();
const currentMilliSeconds = now.millisecond();
const remainder = (currentMinute > 0) ? 10 - (currentMinute % 10) : 10;
return moment(start)
.add(remainder, 'minutes')
.subtract(currentSeconds, 'seconds')
.subtract(currentMilliSeconds, 'milliseconds');
},
PROS 4. The Javascript
Accounting : the easiest way to format number to currency
// Default usage:
accounting.formatMoney(12345678); // $12,345,678.00
// European formatting (custom symbol and separators), can also use options
object as second parameter:
accounting.formatMoney(4999.99, "₩", 2, ".", ","); // ₩4.999,99
// Negative values can be formatted nicely:
accounting.formatMoney(-500000, "£ ", 0); // £ -500,000
// Simple `format` string allows control of symbol position (%v = value, %s =
symbol):
accounting.formatMoney(5318008, { symbol: "원", format: "%v %s" }); //
5,318,008.00 원
PROS 5. CodePush
React-Native runs main.jsbundle over JS thread
… which means you can REPLACE bundle to UPDATE
PROS 5. CodePush
3.3.2 An Application may not download or install executable code.
Interpreted code may only be used in an Application if all scripts,
code and interpreters are packaged in the Application and not
downloaded. The only exception to the foregoing is scripts and
code downloaded and run by Apple's built-in WebKit
framework, provided that such scripts and code do not change
the primary purpose of the Application by providing features
or functionality that are inconsistent with the intended and
advertised purpose of the Application as submitted to the App
Store.
but … it crashes often. don’t rely on it too much…
Apple officially allows code-push
PROS 6. Unit Test
Integration test sucks
1. difficult to write test,
2. impossible to keep it updated
3. takes forever but unreliable
PROS 6. Unit Test
MOCHA ENZYMECHAI
PROS 6. Unit Test
Writing test for react-native is actually fun and easy
Mocha, Enzyme and Chai make it possible
PROS 6. Unit Test
import { expect } from ‘chai’;
import reducer, { resetDate } from ‘./reducer’;
describe(‘reducer’, () => {
it(‘should reset date keeping its duration’, () => {
const startDate = ‘2015-06-05 03:30’, endDate = ‘2015-06-05 06:30’;
expect(
reducer({ startDate, endDate }, resetDate())
).to.deep.equal({
startDate: ‘2015-06-05 04:30’,
endDate: ‘2015-06-05 07:30’,
});
});
});
Writing test for redux with Mocha, Chai
PROS 6. Unit Test
import React, { View, Text } from 'react-native';
import { shallow } from 'enzyme';
import { expect } from ‘chai’;
import Test from ‘./Test’;
describe('<Test />', () => {
it('it should render 1 view component', () => {
const wrapper = shallow(<Test/>);
expect(wrapper.find(View)).to.have.length(1);
});
it('it should render 2 text components', () => {
const wrapper = shallow(<Test/>);
expect(wrapper.find(Text)).to.have.length(2);
});
});
Component test with Enzyme
shallow rendering from `render()`
CONS
CONS 1. Navigation, Navigator, Navigation Bar …
Navigator
Navigator.NavigationBar
NavigatorExperimental
NavigatorIOS
TabBarIOS
DrawerLayoutAndroid
ToolBarAndroid
…
WTF?
CONS 2. Poor documentation, frequent updates
Pooooooooooooor documentation
frequent breaking changes updates
CONS 3. Native Modules
Comparably easier than others
But it take time, efforts and native developer
CONS 4. Schrodinger’s cat in the box
You know nothing Jon Snow inside
CONS 5. Performance
Everyone talks about this but we never felt that yet
performance has never been an issue
there are a lot of other problems to solve…
CONS 5. Performance
Don’t forget this is not meant to work for everything
it has pros and cons and things getting better
but it is true that native app is faster in many ways
POST-MORTEM
POST-MORTEM
Easy to develop
Okay to distribute
Hard to keep it updated
POST-MORTEM
DOs
use redux and code-push
abstract react-native apis
wrap components with container
use npm private registry to share validation
use setState carefully
POST-MORTEM
DON’Ts
don’t believe in react-native packages
use carefully custom router to maximize native experience
don’t think of it as native environment
code-push has problem with redux
nesting components is harmful
SUMMARY
Easy for web front-end developer
Apple allows code-push update for sure
It is almost impossible to catch run-time crash
react-native packages always make problems
build just broke sometimes especially on android
POST-MORTEM
POST-MORTEM
comparatively performant
from both develop and application standpoint
POST-MORTEM
Active and Enthusiastic community
CONCLUSION
Applicable for production use
WE ARE HIRING
JOIN TO WORK TOGETHER
http://socar.recruiter.co.kr
http://seokjun.kr
More stories…

More Related Content

What's hot

What's hot (20)

Plack at YAPC::NA 2010
Plack at YAPC::NA 2010Plack at YAPC::NA 2010
Plack at YAPC::NA 2010
 
Gearman work queue in php
Gearman work queue in phpGearman work queue in php
Gearman work queue in php
 
A few good JavaScript development tools
A few good JavaScript development toolsA few good JavaScript development tools
A few good JavaScript development tools
 
REST to JavaScript for Better Client-side Development
REST to JavaScript for Better Client-side DevelopmentREST to JavaScript for Better Client-side Development
REST to JavaScript for Better Client-side Development
 
Cooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with JitterbugCooking Perl with Chef: Real World Tutorial with Jitterbug
Cooking Perl with Chef: Real World Tutorial with Jitterbug
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloud
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang
 
Vuejs testing
Vuejs testingVuejs testing
Vuejs testing
 
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
 
淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合
 
[1D1]신개념 N스크린 웹 앱 프레임워크 PARS
[1D1]신개념 N스크린 웹 앱 프레임워크 PARS[1D1]신개념 N스크린 웹 앱 프레임워크 PARS
[1D1]신개념 N스크린 웹 앱 프레임워크 PARS
 
Vagrant introduction for Developers
Vagrant introduction for DevelopersVagrant introduction for Developers
Vagrant introduction for Developers
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
Introduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript ConferenceIntroduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript Conference
 
Android Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyondAndroid Jetpack + Coroutines: To infinity and beyond
Android Jetpack + Coroutines: To infinity and beyond
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
 
Zenly - Reverse geocoding
Zenly - Reverse geocodingZenly - Reverse geocoding
Zenly - Reverse geocoding
 
Unit Testing with Jest
Unit Testing with JestUnit Testing with Jest
Unit Testing with Jest
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
 

Viewers also liked

Viewers also liked (20)

신입 개발자 생활백서 [개정판]
신입 개발자 생활백서 [개정판]신입 개발자 생활백서 [개정판]
신입 개발자 생활백서 [개정판]
 
Introducing hikebike.
Introducing hikebike.Introducing hikebike.
Introducing hikebike.
 
Evaluating the Arc-Flash Protection Benefits of IEC 61850 Communication
Evaluating the Arc-Flash Protection Benefits of IEC 61850 CommunicationEvaluating the Arc-Flash Protection Benefits of IEC 61850 Communication
Evaluating the Arc-Flash Protection Benefits of IEC 61850 Communication
 
GraphQL - APIs mais robustas e flexíveis
GraphQL - APIs mais robustas e flexíveisGraphQL - APIs mais robustas e flexíveis
GraphQL - APIs mais robustas e flexíveis
 
Playing with arduino open source h/w for mobile-centric services
Playing with arduino open source h/w for mobile-centric servicesPlaying with arduino open source h/w for mobile-centric services
Playing with arduino open source h/w for mobile-centric services
 
Meetup React Native
Meetup React NativeMeetup React Native
Meetup React Native
 
아두이노 4강 maker_school
아두이노 4강 maker_school아두이노 4강 maker_school
아두이노 4강 maker_school
 
강의자료 코딩클럽 아두이노 워크샵-2015.4.11
강의자료 코딩클럽 아두이노 워크샵-2015.4.11강의자료 코딩클럽 아두이노 워크샵-2015.4.11
강의자료 코딩클럽 아두이노 워크샵-2015.4.11
 
아두이노 5강 maker_school
아두이노 5강 maker_school아두이노 5강 maker_school
아두이노 5강 maker_school
 
아두이노 1강 maker_school
아두이노 1강 maker_school아두이노 1강 maker_school
아두이노 1강 maker_school
 
React Native Internals
React Native InternalsReact Native Internals
React Native Internals
 
아두이노 3강 maker_school
아두이노 3강 maker_school아두이노 3강 maker_school
아두이노 3강 maker_school
 
아두이노 2강 maker_school
아두이노 2강 maker_school아두이노 2강 maker_school
아두이노 2강 maker_school
 
Introduzione a React Native - Alessandro Giannini
Introduzione a React Native - Alessandro GianniniIntroduzione a React Native - Alessandro Giannini
Introduzione a React Native - Alessandro Giannini
 
React & Redux
React & ReduxReact & Redux
React & Redux
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
React native - What, Why, How?
React native - What, Why, How?React native - What, Why, How?
React native - What, Why, How?
 
Universal Rendering
Universal RenderingUniversal Rendering
Universal Rendering
 
SONY BBS - React Native
SONY BBS - React NativeSONY BBS - React Native
SONY BBS - React Native
 
Conhecendo API do Facebook
Conhecendo API do FacebookConhecendo API do Facebook
Conhecendo API do Facebook
 

Similar to React Native in Production

Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
Andy Peterson
 

Similar to React Native in Production (20)

Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
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
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
React Native for ReactJS Devs
React Native for ReactJS DevsReact Native for ReactJS Devs
React Native for ReactJS Devs
 
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
 
7 Redux challenges
7 Redux challenges7 Redux challenges
7 Redux challenges
 
Building cross-platform mobile apps with React Native (Jfokus 2017)
Building cross-platform mobile apps with React Native (Jfokus 2017)Building cross-platform mobile apps with React Native (Jfokus 2017)
Building cross-platform mobile apps with React Native (Jfokus 2017)
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend Developers
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
Building framework with shared code on Android and iOS using React Native. UA...
Building framework with shared code on Android and iOS using React Native. UA...Building framework with shared code on Android and iOS using React Native. UA...
Building framework with shared code on Android and iOS using React Native. UA...
 
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
 
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: Introduction
React Native: IntroductionReact Native: Introduction
React Native: Introduction
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
React native
React nativeReact native
React native
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end FrameworkCrossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end Framework
 
Redux at scale
Redux at scaleRedux at scale
Redux at scale
 
10 tips for Redux at scale
10 tips for Redux at scale10 tips for Redux at scale
10 tips for Redux at scale
 
Programming
ProgrammingProgramming
Programming
 

Recently uploaded

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 

Recently uploaded (20)

The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdf
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Agentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfAgentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdf
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 

React Native in Production

  • 1. React Native in Production Build Native Mobile Apps using JavaScript and React
  • 2. Kim Seokjun aka alma Front-end web developer at SOCAR Working as DevOps - react.js, react-native, node.js, express.js, docker Interested in - go, tensorflow, functional programming
  • 4.
  • 8. WHY? 1. To avoid risk mixing Single bug may affect two services SOCAR is already huge and complex application
  • 9. WHY? 2. Not much to share with SOCAR ZEROCAR is running over SOCAR but in behavioral standpoint it’s not
  • 10. WHY? 3. Minimize features and quick updates Feature list was too long for 3 weeks So decided to spec out most and focus on criticals
  • 11. WHY? 4. iOS and Android Android 60% iOS 40%
  • 12. WHY? 5. React experienced web developer
  • 14. PROS
  • 15. PROS 1. It’s REACT! React + Redux + ES6 = Awesome! import { ScrollView } from ‘react-native’ import { Profile, SharingStatus, Scheduler } from ‘@components’ class HomeContainer extends React { refresh() { fetch(‘http://api.url).then((res) => this.props.getSharingStatus(res)) } render() { <ScrollView> <Profile /> <SharingStatus /> <Scheduler /> </ScrollView> } }
  • 16. PROS 2. FLEX Layout CSS the good parts : Flex layout is very Flexible <View style={{ flex: 1 }}> <View style={{ flex: 1 }} /> <View style={{ flex: 1 }} /> <View style={{ height: 100 }} /> </View> height: 100 flex: 1 flex: 1 Viewport
  • 17. PROS 2. FLEX Layout CSS the good parts : Flex layout is very Flexible flex: 1 flex: 1 Viewport <View style={{ height: 50, flexDirection: ‘row’ }}> <View style={{ flex: 1 }} /> <View style={{ flex: 1 }} /> </View> height: 50 flexDirection: ‘row’
  • 18. PROS 2. FLEX Layout CSS the good parts : Flex layout is very Flexible <View style={{ justifyContent: ‘center’, alignItems: ‘center’, }} > <Text style={{ width: 50, }} > Centered </Text> </View> Centered Viewport justifyContent: ‘center’ alignItems: ‘center’
  • 19. PROS 3. No compile, Hot-reload Thank you Dan! I love you! Really! Love you! My Jesus! Dan Abramov, author of Redux and React Hot Reloader
  • 20. PROS 4. The Javascript Lodash Moment.js Accounting
  • 21. PROS 4. The Javascript Lodash : the functional programming const getCamelCased = (text: string) => { if (!text) return null; return text.replace(/-([a-z])/g, (g) => g[1].toUpperCase()); }; const getButtonStyle = (className) => { if (!className) return null; return _.chain(['btn', 'normal', ...className.split(/s/)]) .map(elem => styles[getCamelCased(elem)]) .value(); };
  • 22. PROS 4. The Javascript Moment : date-time eternal villain for developer const getMinStartDate = (endDate) => { if (endDate) return moment(endDate).subtract(120, 'minutes'); const now = moment(); const currentMinute = now.minute(); const currentSeconds = now.second(); const currentMilliSeconds = now.millisecond(); const remainder = (currentMinute > 0) ? 10 - (currentMinute % 10) : 10; return moment(start) .add(remainder, 'minutes') .subtract(currentSeconds, 'seconds') .subtract(currentMilliSeconds, 'milliseconds'); },
  • 23. PROS 4. The Javascript Accounting : the easiest way to format number to currency // Default usage: accounting.formatMoney(12345678); // $12,345,678.00 // European formatting (custom symbol and separators), can also use options object as second parameter: accounting.formatMoney(4999.99, "₩", 2, ".", ","); // ₩4.999,99 // Negative values can be formatted nicely: accounting.formatMoney(-500000, "£ ", 0); // £ -500,000 // Simple `format` string allows control of symbol position (%v = value, %s = symbol): accounting.formatMoney(5318008, { symbol: "원", format: "%v %s" }); // 5,318,008.00 원
  • 24. PROS 5. CodePush React-Native runs main.jsbundle over JS thread … which means you can REPLACE bundle to UPDATE
  • 25. PROS 5. CodePush 3.3.2 An Application may not download or install executable code. Interpreted code may only be used in an Application if all scripts, code and interpreters are packaged in the Application and not downloaded. The only exception to the foregoing is scripts and code downloaded and run by Apple's built-in WebKit framework, provided that such scripts and code do not change the primary purpose of the Application by providing features or functionality that are inconsistent with the intended and advertised purpose of the Application as submitted to the App Store. but … it crashes often. don’t rely on it too much… Apple officially allows code-push
  • 26. PROS 6. Unit Test Integration test sucks 1. difficult to write test, 2. impossible to keep it updated 3. takes forever but unreliable
  • 27. PROS 6. Unit Test MOCHA ENZYMECHAI
  • 28. PROS 6. Unit Test Writing test for react-native is actually fun and easy Mocha, Enzyme and Chai make it possible
  • 29. PROS 6. Unit Test import { expect } from ‘chai’; import reducer, { resetDate } from ‘./reducer’; describe(‘reducer’, () => { it(‘should reset date keeping its duration’, () => { const startDate = ‘2015-06-05 03:30’, endDate = ‘2015-06-05 06:30’; expect( reducer({ startDate, endDate }, resetDate()) ).to.deep.equal({ startDate: ‘2015-06-05 04:30’, endDate: ‘2015-06-05 07:30’, }); }); }); Writing test for redux with Mocha, Chai
  • 30. PROS 6. Unit Test import React, { View, Text } from 'react-native'; import { shallow } from 'enzyme'; import { expect } from ‘chai’; import Test from ‘./Test’; describe('<Test />', () => { it('it should render 1 view component', () => { const wrapper = shallow(<Test/>); expect(wrapper.find(View)).to.have.length(1); }); it('it should render 2 text components', () => { const wrapper = shallow(<Test/>); expect(wrapper.find(Text)).to.have.length(2); }); }); Component test with Enzyme shallow rendering from `render()`
  • 31. CONS
  • 32. CONS 1. Navigation, Navigator, Navigation Bar … Navigator Navigator.NavigationBar NavigatorExperimental NavigatorIOS TabBarIOS DrawerLayoutAndroid ToolBarAndroid … WTF?
  • 33. CONS 2. Poor documentation, frequent updates Pooooooooooooor documentation frequent breaking changes updates
  • 34. CONS 3. Native Modules Comparably easier than others But it take time, efforts and native developer
  • 35. CONS 4. Schrodinger’s cat in the box You know nothing Jon Snow inside
  • 36. CONS 5. Performance Everyone talks about this but we never felt that yet performance has never been an issue there are a lot of other problems to solve…
  • 37. CONS 5. Performance Don’t forget this is not meant to work for everything it has pros and cons and things getting better but it is true that native app is faster in many ways
  • 39. POST-MORTEM Easy to develop Okay to distribute Hard to keep it updated
  • 40. POST-MORTEM DOs use redux and code-push abstract react-native apis wrap components with container use npm private registry to share validation use setState carefully
  • 41. POST-MORTEM DON’Ts don’t believe in react-native packages use carefully custom router to maximize native experience don’t think of it as native environment code-push has problem with redux nesting components is harmful
  • 42. SUMMARY Easy for web front-end developer Apple allows code-push update for sure It is almost impossible to catch run-time crash react-native packages always make problems build just broke sometimes especially on android POST-MORTEM
  • 43. POST-MORTEM comparatively performant from both develop and application standpoint
  • 47.
  • 48. WE ARE HIRING JOIN TO WORK TOGETHER http://socar.recruiter.co.kr