Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
React, ComponentKit and React Native
Search
Paul Taykalo
July 06, 2015
Programming
2
400
React, ComponentKit and React Native
History of React, ComponentKit, React Native, when should I use it, how it works under the hood
Paul Taykalo
July 06, 2015
Tweet
Share
More Decks by Paul Taykalo
See All by Paul Taykalo
There's no virus on Mac
paultaykalo
0
270
On guard of surce code
paultaykalo
0
140
Source Code as Input
paultaykalo
0
77
Reactive Programming Workshop
paultaykalo
0
100
Why we are (not) writing tests in iOS
paultaykalo
1
240
Lost in maintenance in Swift
paultaykalo
0
430
Как в короткое время силами существующей команды без дизайнера выпустить мультиплатформенное приложение
paultaykalo
0
130
Code Generators In Swift (Part 2)
paultaykalo
2
180
Applications that broke... somewhere
paultaykalo
1
72
Other Decks in Programming
See All in Programming
offers_20241022_imakiire.pdf
imakurusu
2
360
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
550
Piniaの現状と今後
waka292
5
1.5k
Server Driven Compose With Firebase
skydoves
0
400
EventSourcingの理想と現実
wenas
6
2.1k
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
23k
リリース8年目のサービスの1800個のERBファイルをViewComponentに移行した方法とその結果
katty0324
5
3.6k
2万ページのSSG運用における工夫と注意点 / Vue Fes Japan 2024
chinen
3
1.3k
Googleのテストサイズを活用したテスト環境の構築
toms74209200
0
270
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
150
飲食業界向けマルチプロダクトを実現させる開発体制とリアルな現状
hiroya0601
1
400
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
440
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
50
7.2k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
GitHub's CSS Performance
jonrohan
1030
460k
Making the Leap to Tech Lead
cromwellryan
132
8.9k
Designing for humans not robots
tammielis
249
25k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
14
1.9k
The Cost Of JavaScript in 2023
addyosmani
45
6.6k
Producing Creativity
orderedlist
PRO
341
39k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
Typedesign – Prime Four
hannesfritz
39
2.4k
Art, The Web, and Tiny UX
lynnandtonic
296
20k
Transcript
ComponentKit and React Native Paul Taykalo, ComponentKit and React Native,
Stanfy, 2015 1
What is it about? » 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.js Paul 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
Few months later... Paul Taykalo, ComponentKit and React Native, Stanfy,
2015 8
Awesome! It works! Let's do it Native 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
Native vs Javascript Paul Taykalo, ComponentKit and React Native, Stanfy,
2015 13
(HTML + JS) vs (UIKit + ObjC) Paul Taykalo, ComponentKit
and React Native, Stanfy, 2015 14
Screw IT! Paul Taykalo, ComponentKit and React Native, Stanfy, 2015
15
Let's do it native! 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
Declarative vs Imperative Paul Taykalo, ComponentKit and React Native, Stanfy,
2015 23
Declarative Write what result do you want Paul Taykalo, ComponentKit
and React Native, Stanfy, 2015 24
Imperative Write how to get the result Paul Taykalo, ComponentKit
and React Native, Stanfy, 2015 25
A bit complex 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
A bit complex 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
A bit complex example imperative Paul Taykalo, ComponentKit and React
Native, Stanfy, 2015 28
Immutability One does not simply mutate component Paul Taykalo, ComponentKit
and React Native, Stanfy, 2015 29
StateLess* Components tend to be stateless Paul Taykalo, ComponentKit and
React Native, Stanfy, 2015 30
Virtual "DOM" in ComponentKit How to render all stuff that
user written Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 31
Component tree -> (Magic) -> UIKit tree Paul Taykalo, ComponentKit
and React Native, Stanfy, 2015 32
Component is not an UIView Not Every Component backed up
with UIView Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 33
ComponentKit Layout Paul Taykalo, ComponentKit and React Native, Stanfy, 2015
34
Autolayout ? Manual Layout? Paul Taykalo, ComponentKit and React Native,
Stanfy, 2015 35
Autolayout ? Manual Layout? FlexBox* Paul Taykalo, ComponentKit and React
Native, Stanfy, 2015 36
ComponentKit is awesome 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 back to Javascript Paul Taykalo, ComponentKit and React Native,
Stanfy, 2015 40
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 41
React Native Paul Taykalo, ComponentKit and React Native, Stanfy, 2015
42
Oh, I know! Javascript + HTML again? Paul Taykalo, ComponentKit
and React Native, Stanfy, 2015 43
React Native Native Code Bridge Javascript Paul Taykalo, ComponentKit and
React Native, Stanfy, 2015 44
React Native Native Code Bridge Javascript Paul Taykalo, ComponentKit and
React Native, Stanfy, 2015 45
React Native Native Code Bridge Javascript Paul Taykalo, ComponentKit and
React Native, Stanfy, 2015 46
React Native Native Code Bridge Javascript Paul Taykalo, ComponentKit and
React Native, Stanfy, 2015 47
Nah, It cannot be fast! Paul Taykalo, ComponentKit and React
Native, Stanfy, 2015 48
Nah, It cannot be fast! It cannot run faster that
native Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 49
Nah, It renders in UIWebView It's slow! Paul Taykalo, ComponentKit
and React Native, Stanfy, 2015 50
Nah, It renders in UIWebView It's slow! It uses UIKit
for rendering Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 51
Nah, I know Native -> JS communication is one-threaded and
synchronous Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 52
Nah, I know Native -> JS communication is one-threaded and
synchronous React Native uses calls batching React Native is fully asynchronous Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 53
Nah, I know that... Paul Taykalo, ComponentKit and React Native,
Stanfy, 2015 54
Stop it! Decide for yourself React Native Playground iOS App
Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 55
React Native Playground iOS App Paul Taykalo, ComponentKit and React
Native, Stanfy, 2015 56
React Native Template Paul Taykalo, ComponentKit and React Native, Stanfy,
2015 57
React Native Development Paul Taykalo, ComponentKit and React Native, Stanfy,
2015 58
React Native 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 get it What is there any cons? Paul
Taykalo, ComponentKit and React Native, Stanfy, 2015 60
React Native » Animations » Native Components » Complex gesture
recognizers » Extensive computations » new Paradigm Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 61
Where to start from? Paul Taykalo, ComponentKit and React Native,
Stanfy, 2015 62
Where to start from? » M(V)VM » React.js » ComponentKit
» React Native Paul Taykalo, ComponentKit and React Native, Stanfy, 2015 63
So can Javascript be fast? Paul Taykalo, ComponentKit and React
Native, Stanfy, 2015 64
So can Javascript be fast? It can be fast enough
:) 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
Component Kit and React Native by Paul Taykalo, Stanfy Paul
Taykalo, ComponentKit and React Native, Stanfy, 2015 68