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
Easy Way to Improve ReactNative
Search
Sergio Utama
July 12, 2018
Programming
270
0
Share
Easy Way to Improve ReactNative
5 easy way to improve ReactNative project
Sergio Utama
July 12, 2018
More Decks by Sergio Utama
See All by Sergio Utama
From try! Swift Tokyo 2017
sergioutama
0
64
Migrating to Swift 3
sergioutama
0
56
Taming AutoLayout
sergioutama
0
50
10 Things I learned while freelancing
sergioutama
0
60
iOS Video Player
sergioutama
0
92
Tribute to Mantle
sergioutama
0
31
Mobile Analytics
sergioutama
0
46
Other Decks in Programming
See All in Programming
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
1k
Radical Imagining - LIFT 2025-2027 Policy Agenda
lift1998
0
250
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
150
Don't Prompt Harder, Structure Better
kitasuke
0
670
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
3
520
Codex CLI でつくる、Issue から merge までの開発フロー
amata1219
0
340
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
460
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.8k
VueエンジニアがReactを触って感じた_設計の違い
koukimiura
0
170
forteeの改修から振り返るPHPerKaigi 2026
muno92
PRO
3
260
3分でわかるatama plusのQA/about atama plus QA
atamaplus
0
130
PHPで TLSのプロトコルを実装してみる
higaki_program
0
760
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.6k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
250
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
330
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
200
sira's awesome portfolio website redesign presentation
elsirapls
0
210
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
420
Information Architects: The Missing Link in Design Systems
soysaucechin
0
870
Six Lessons from altMBA
skipperchong
29
4.2k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Paper Plane
katiecoart
PRO
1
49k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Transcript
Easy way to improve your ReactNative Project by @sergioutama @sergioutama
$ whoami Sergio Utama Just your friendly programmer @sergioutama
Don't Use ReactNative @sergioutama
The end @sergioutama
Just kidding ! @sergioutama
1. Fix your project structure @sergioutama
Why — Easier to navigate and maintain — Mental image
how code should be structured @sergioutama
How ~ components for reusable globaly ~ Split based on
screen OR module ~ each screen has its component @sergioutama
2. Stop using arrow function @sergioutama
Arrow function ( () => {}) is a necessary evil
of js world. It make easy to ignore this @sergioutama
However, arrow function actually assigning a new value. Calling it
within render() function will give significant impact on your app performance @sergioutama
Solution? bind early or declare it outside render() @sergioutama
3. Own your component lifecycle @sergioutama
React gave us PureComponent and shouldComponentUpdate to use. Use it!
@sergioutama
Understand how React lifecycle and avoid unecessary render by extending
PureComponent or implementing shouldComponentUpdate. Be!er: fully utilize the whole lifecycle functions. @sergioutama
@sergioutama
4. Component everything @sergioutama
Keep your component small. It's not a dick measuring contents
If more than 6 elements, move it to a component @sergioutama
5. It's either Component OR PureComponent @sergioutama
const modalClosed = ()=>{} const LoadingOverlay = (props) => {
const { loading, message, ...attributes } = props; const defaultMessage = message || ''; return ( <Modal transparent animationType={'none'} visible={loading} onRequestClose={modalClosed} > <View style={styles.modalBackground}> <View style={styles.activityIndicatorWrapper}> <ActivityIndicator animating={loading} /> <Text style={styles.loadingText}>{defaultMessage}</Text> </View> </View> </Modal> ); }; @sergioutama
const modalClose = () => {}; export default class LoadingOverlay
extends React.Component<Props> { render() { const { loading, message, style } = this.props; const defaultMessage = message || ""; return ( <Modal transparent animationType={"none"} visible={loading} onRequestClose={modalClose} > <View style={styles.modalBackground}> <View style={styles.activityIndicatorWrapper}> <ActivityIndicator animating={loading} /> <Text style={styles.loadingText}>{defaultMessage}</Text> </View> </View> </Modal> ); } } @sergioutama
Why Similar but not the same It makes sense on
web or React to use functional stateless component It doesn't make sense on ReactNative Component make it easier to debug view hierarchy @sergioutama
Learn Native and its tools Not so easy way @sergioutama
ReactNative is not a crossplatform. It's not meant that way.
— Sergio Utama @sergioutama
Native Concept: Navigation, Containtment, Signing, Activty vs Fragments, Permission, etc
Tools: Xcode, Gradle, Fastlane @sergioutama
Q&A @sergioutama
The end? Thank you — @sergioutama @sergioutama