SlideShare a Scribd company logo
ComponentKit
and
ReactNative
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 1
Whatis itabout?» React.js, ComponentKit, React native
» Native vs Javascript
» UI, do you speak it?
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 2
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 3
React.jsPaul Taykalo, ComponentKit and React Native, Stanfy, 2015 4
React.js
Simple
“Simply express how your app should look at any given
point in time, and React will automatically manage
all UI updates when your underlying data changes.”
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 5
React.js
Declarative
“When the data changes, React conceptually hits the
"refresh" button, and knows to only update the
changed parts.”
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 6
React.js
Implementation
» Just the UI
» Virtual DOM*
» Data Flow
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 7
Fewmonths later...
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 8
Awesome! Itworks!
Let's do itNative
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 9
UIWebView?
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 10
UIWebView?
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 11
PhoneGap + React.js
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 12
NativevsJavascript
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 13
(HTML+JS)vs (UIKit+ ObjC)
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 14
ScrewIT!
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 15
Let's do itnative!
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 16
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 17
ComponentKit
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 18
ComponentKit» UIKit
» Components
» One-Way DataFlow
» ObjectiveC++
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 19
Write once, run everywhere
Java, Sun Microsystems
Learn once, use everywhere
React, Facebook
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 20
React.js
var HelloMessage = React.createClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
React.render(
<HelloMessage name="John" />,
document.getElementById('container')
);
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 21
ComponentKit
@implementation HelloMessageComponent
+ (instancetype)newWithName:(NSString*)name {
return [super newWithComponent:
[CKLabelComponent
newWithLabelAttributes:{
.string = [NSString stringWithFormat:@"Hello %@", @name],
}
viewAttributes:{}
];
}
@end
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 22
Declarativevs Imperative
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 23
DeclarativeWrite what result do you want
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 24
ImperativeWrite howto getthe result
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 25
Abitcomplex example declarative
+ (instancetype)newWithStory:(FBStory *)story
{
return [super newWithComponent:
[FBStackLayoutComponent
newWithView:{}
size:{}
style:{.alignItems = FBStackLayoutAlignItemsStretch}
children:{
{[FBHeaderComponent newWithStory:story]},
{[FBMessageComponent newWithStory:story]},
{[FBAttachmentComponent newWithStory:story]},
{[FBLikeBarComponent newWithStory:story]},
}]];
}
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 26
Abitcomplex example imperative
@implementation FBStoryView
{
FBHeaderView *_headerView;
FBMessageView *_messageView;
FBAttachmentView *_attachmentView;
FBLikeBarView *_likeBarView;
}
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
_headerView = [[FBHeaderView alloc] init];
_messageView = [[FBMessageView alloc] init];
_attachmentView = [[FBAttachmentView alloc] init];
_likeBarView = [[FBLikeBarView alloc] init];
[self addSubview:_headerView];
[self addSubview:_messageView];
[self addSubview:_attachmentView];
[self addSubview:_likeBarView];
}
return self;
}
- (CGSize)sizeThatFits:(CGSize)size
{
return CGSizeMake(size.width,
[_headerView sizeThatFits:CGSizeMake(size.width, CGFLOAT_MAX)].height
+ [_messageView sizeThatFits:CGSizeMake(size.width, CGFLOAT_MAX)].height
+ [_attachmentView sizeThatFits:CGSizeMake(size.width, CGFLOAT_MAX)].height
+ [_likeBarView sizeThatFits:CGSizeMake(size.width, CGFLOAT_MAX)].height);
}
- (void)layoutSubviews
{
CGFloat width = [self bounds].size.width;
CGFloat y = 0;
CGFloat headerHeight = [_headerView sizeThatFits:CGSizeMake(width, CGFLOAT_MAX)].height;
[_headerView setFrame:CGRectMake(0, y, width, headerHeight)];
y += headerHeight;
CGFloat messageHeight = [_messageView sizeThatFits:CGSizeMake(width, CGFLOAT_MAX)].height;
[_messageView setFrame:CGRectMake(0, y, width, messageHeight)];
y += messageHeight;
CGFloat attachmentHeight = [_attachmentView sizeThatFits:CGSizeMake(width, CGFLOAT_MAX)].height;
[_attachmentView setFrame:CGRectMake(0, y, width, attachmentHeight)];
y += attachmentHeight;
CGFloat likeBarHeight = [_likeBarView sizeThatFits:CGSizeMake(width, CGFLOAT_MAX)].height;
[_likeBarView setFrame:CGRectMake(0, y, width, likeBarHeight)];
y += likeBarHeight;
}
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 27
Abitcomplex example imperative
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 28
ImmutabilityOne does notsimply mutate component
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 29
StateLess*Componentstendto be stateless
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 30
Virtual"DOM"
in ComponentKitHowto render allstuffthatuser written
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 31
Componenttree
-> (Magic)
-> UIKittree
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 32
Component is notan UIView
Not EveryComponentbacked upwith UIView
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 33
ComponentKit Layout
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 34
Autolayout? ManualLayout?
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 35
Autolayout?ManualLayout?
FlexBox*
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 36
ComponentKit
isawesome
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 37
ComponentKit downsides
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 38
ComponentKit downsides
» Native (I cannot write for Android)
» I need to compile it each time I change something
» I cannot share the code
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 39
Let's backtoJavascript
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 40
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 41
ReactNative
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 42
Oh, I know!Javascript+ HTMLagain?
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 43
React Native
NativeCode
Bridge
JavascriptPaul Taykalo, ComponentKit and React Native, Stanfy, 2015 44
React Native
NativeCode
Bridge
JavascriptPaul Taykalo, ComponentKit and React Native, Stanfy, 2015 45
React Native
NativeCode
Bridge
JavascriptPaul Taykalo, ComponentKit and React Native, Stanfy, 2015 46
React Native
NativeCode
Bridge
JavascriptPaul Taykalo, ComponentKit and React Native, Stanfy, 2015 47
Nah, Itcannotbe fast!
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 48
Nah,Itcannotbefast!Itcannotrun fasterthatnative
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 49
Nah, Itrenders in UIWebView
It's slow!
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 50
Nah,ItrendersinUIWebView
It'sslow!Ituses UIKit for rendering
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 51
Nah, I knowNative ->JS communication
is one-threadedand synchronous
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 52
Nah,IknowNative->JScommunication
isone-threadedandsynchronous
ReactNative uses calls batching
ReactNative is fullyasynchronous
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 53
Nah, I knowthat...
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 54
Stopit!Decide foryourself
ReactNative
Playground iOSAppPaul Taykalo, ComponentKit and React Native, Stanfy, 2015 55
ReactNative Playground iOSApp
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 56
ReactNativeTemplate
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 57
ReactNative Development
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 58
ReactNative Development
» Live Reload
» Debugging Javascript in Browers
» FPS Monitor (Javscrip and UI)
» Inspect UI Elements (UIView deubgging)
» Profiling
» Modules
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 59
Ok, I getitWhatisthereanycons?
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 60
ReactNative
» Animations
» Native Components
» Complex gesture recognizers
» Extensive computations
» new Paradigm
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 61
Whereto start from?
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 62
Whereto start from?
» M(V)VM
» React.js
» ComponentKit
» React Native
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 63
So canJavascriptbe fast?
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 64
SocanJavascriptbefast?
Itcan be fastenough :)
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 65
Links
» https://code.facebook.com/posts/1014532261909640/
react-native-bringing-modern-web-techniques-to-
mobile/
» http://www.reactnative.com/
» https://developer.mozilla.org/en-US/docs/Web/
Guide/CSS/Flexible_boxes
» http://www.objc.io/issues/22-scale/facebook/
» https://code.facebook.com/posts/1014532261909640/
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 66
Links
» https://speakerdeck.com/frantic/react-native-
under-the-hood
» http://www.objc.io/issues/22-scale/facebook/
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 67
ComponentKitand ReactNative
byPaulTaykalo, Stanfy
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 68

More Related Content

PDF
JavaScript, React Native and Performance at react-europe 2016
PDF
React Native - Getting Started
PPTX
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
PDF
Introduction of React.js
PDF
Get Hip with Java Hipster - JavaOne 2017
PDF
Node.js and Selenium Webdriver, a journey from the Java side
PDF
Using React with Grails 3
PDF
Matteo Manchi - React Native for multi-platform mobile applications - Codemot...
JavaScript, React Native and Performance at react-europe 2016
React Native - Getting Started
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Introduction of React.js
Get Hip with Java Hipster - JavaOne 2017
Node.js and Selenium Webdriver, a journey from the Java side
Using React with Grails 3
Matteo Manchi - React Native for multi-platform mobile applications - Codemot...

What's hot (20)

PDF
React Native Workshop - React Alicante
PDF
Front End Development for Back End Developers - UberConf 2017
PDF
React Native +Redux + ES6 (Updated)
PDF
A Closer Look At React Native
PDF
The Ultimate Getting Started with Angular Workshop - Devoxx UK 2017
PPTX
Grails Spring Boot
PDF
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
PDF
Spring IO '15 - Developing microservices, Spring Boot or Grails?
PDF
Philip Shurpik "Architecting React Native app"
PDF
Lviv MD Day 2015 Іван Лаврів "Mobile development with React Native"
PDF
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...
PDF
Feedback en continu grâce au TDD et au AsCode
PDF
Workshop React.js
PDF
Bootiful Development with Spring Boot and Angular - Connect.Tech 2017
PDF
Introducing Playwright's New Test Runner
PPTX
Concurrent Rendering Adventures in React 18
PDF
A tour of React Native
PDF
Using JHipster for generating Angular/Spring Boot apps
PDF
We Are Developers - Modern React (Suspense, Context, Hooks) - Roy Derks
PDF
React Native - Workshop
React Native Workshop - React Alicante
Front End Development for Back End Developers - UberConf 2017
React Native +Redux + ES6 (Updated)
A Closer Look At React Native
The Ultimate Getting Started with Angular Workshop - Devoxx UK 2017
Grails Spring Boot
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Spring IO '15 - Developing microservices, Spring Boot or Grails?
Philip Shurpik "Architecting React Native app"
Lviv MD Day 2015 Іван Лаврів "Mobile development with React Native"
Developing PWAs and Mobile Apps with Ionic, Angular, and JHipster - Devoxx Mo...
Feedback en continu grâce au TDD et au AsCode
Workshop React.js
Bootiful Development with Spring Boot and Angular - Connect.Tech 2017
Introducing Playwright's New Test Runner
Concurrent Rendering Adventures in React 18
A tour of React Native
Using JHipster for generating Angular/Spring Boot apps
We Are Developers - Modern React (Suspense, Context, Hooks) - Roy Derks
React Native - Workshop
Ad

Similar to ComponenKit and React Native (20)

PDF
React Native and the future of web technology (Mark Wilcox) - GreeceJS #15
PPTX
Should you react?
PDF
Introduction to ReactJS
PDF
Introduzione a React Native - Facebook Developer Circle Rome
PPTX
React advance
ODP
Qt Workshop
PDF
React native
PDF
React native sharing
PDF
Railsconf 2017 - React & React Native a common codebase across native and web
PDF
React a11y-csun
PDF
Anko & Karamba in Kotlin by Bapusaheb Patil
PDF
A Practical Approach to React Native at All Things Open Conference
PDF
Volto: Plone Conference 2018
PDF
Getting Started with React
PPTX
Pluginkla2019 - React Presentation
PPT
Testing of javacript
PDF
Introduction to ReactJS and Redux
PDF
Bowtie: Interactive Dashboards
PPTX
Introduction to React
PDF
React native.key
React Native and the future of web technology (Mark Wilcox) - GreeceJS #15
Should you react?
Introduction to ReactJS
Introduzione a React Native - Facebook Developer Circle Rome
React advance
Qt Workshop
React native
React native sharing
Railsconf 2017 - React & React Native a common codebase across native and web
React a11y-csun
Anko & Karamba in Kotlin by Bapusaheb Patil
A Practical Approach to React Native at All Things Open Conference
Volto: Plone Conference 2018
Getting Started with React
Pluginkla2019 - React Presentation
Testing of javacript
Introduction to ReactJS and Redux
Bowtie: Interactive Dashboards
Introduction to React
React native.key
Ad

More from Stanfy (19)

PDF
Stanfy MadCode Meetup #11: Why do you need to switch from Obj-C to Swift, or ...
PDF
Avoiding damage, shame and regrets data protection for mobile client-server a...
PDF
Data processing components architecture in mobile applications
PDF
Data transfer security for mobile apps
PDF
Stanfy MadCode Meetup #9: Functional Programming 101 with Swift
PDF
Building Profanity Filters: clbuttic sh!t
PDF
Optimistic Approach. How to show results instead spinners without breaking yo...
PDF
Users' Data Security in iOS Applications
PDF
UX Research in mobile
PDF
Remote user research & usability methods
PDF
Stanfy MadCode Meetup#6: Apple Watch. First Steps.
PDF
Stanfy MadCode Meetup: Анализ и модификация HTTP запросов для тестирования мо...
PDF
Stanfy's highlights of 2013
PDF
10 things to consider when choosing a mobile platform (iOS or Android)
PDF
Stanfy Publications: How to Conduct Quick Usability Tests for iOS & Android A...
PDF
Stanfy Publications: Mobile Applications UI/UX Prototyping Process
PDF
Stanfy Publications: Successful Cases of Mobile Technology in Medical Industry
PDF
Android Developer Days: Increasing performance of big arrays processing on An...
PDF
Fitness In Mobile: A Case Study.
Stanfy MadCode Meetup #11: Why do you need to switch from Obj-C to Swift, or ...
Avoiding damage, shame and regrets data protection for mobile client-server a...
Data processing components architecture in mobile applications
Data transfer security for mobile apps
Stanfy MadCode Meetup #9: Functional Programming 101 with Swift
Building Profanity Filters: clbuttic sh!t
Optimistic Approach. How to show results instead spinners without breaking yo...
Users' Data Security in iOS Applications
UX Research in mobile
Remote user research & usability methods
Stanfy MadCode Meetup#6: Apple Watch. First Steps.
Stanfy MadCode Meetup: Анализ и модификация HTTP запросов для тестирования мо...
Stanfy's highlights of 2013
10 things to consider when choosing a mobile platform (iOS or Android)
Stanfy Publications: How to Conduct Quick Usability Tests for iOS & Android A...
Stanfy Publications: Mobile Applications UI/UX Prototyping Process
Stanfy Publications: Successful Cases of Mobile Technology in Medical Industry
Android Developer Days: Increasing performance of big arrays processing on An...
Fitness In Mobile: A Case Study.

Recently uploaded (6)

PDF
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
PPTX
ASMS Telecommunication company Profile
PDF
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
PPTX
Introduction to Packet Tracer Course Overview - Aug 21 (1).pptx
DOC
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
DOC
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
ASMS Telecommunication company Profile
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
Introduction to Packet Tracer Course Overview - Aug 21 (1).pptx
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证

ComponenKit and React Native