Slide 1

Slide 1 text

React Native for Unified Codebase Dec 14th, 2016

Slide 2

Slide 2 text

@sonnylazuardi

Slide 3

Slide 3 text

Sale Stock 1 Codebase 3 Platforms Web Cordova Android iOS

Slide 4

Slide 4 text

UI-Kit & Styling ● Based on Primitive Component (like: github.com/lelandrichardson/react-p rimitives) ● Include Text, View, Image, Button, TextInput ● No gradient ● Flexbox vs CSS

Slide 5

Slide 5 text

Routing ● Custom Router based on https://github.com/mjackson/history ● Support Code Splitting on web ● Save current scrolling position based on route

Slide 6

Slide 6 text

Native Modules ● One Signal Push Notification ● Facebook & Google Sign In ● Google Smart Lock ● Google Analytics ● Image Picker, Image Zoom ● Appsflyer, Crashlytics

Slide 7

Slide 7 text

Prototyping ● Apollo Client to get rid of reducers ● Exponent allows developing app without Android SDK, XCode. ● Exponent allows direct deploy to ios and android devices

Slide 8

Slide 8 text

Performance Tuning

Slide 9

Slide 9 text

Startup Memory Usage

Slide 10

Slide 10 text

Scrolling Memory Usage ● Get an infinite scroll on our app, 25000++ live products to show. ● https://github.com/brentvatne/fixed- height-windowed-list-view-experime nt ● Solve the dynamic height listview by preprocessing items’ height array.

Slide 11

Slide 11 text

Scrolling Memory Usage Comparison

Slide 12

Slide 12 text

Faster Startup ● Batch initial bootstrap requests ● Prefetch Initial Data on Native Side ● (-) Slow Transition Between Tabs Up to 10 secs faster on low-end devices under 2G

Slide 13

Slide 13 text

GraphQL Batching getCart() getCatalogue() getFoo() getBar() [getCart(), getCatalogue(), getFoo(), getBar()] Start App Start App

Slide 14

Slide 14 text

GraphQL Batching ● Faster time-to-render on slower networks, like 2G Connections. ● Cut down 6 different HTTP calls into 1 call to render the homepage

Slide 15

Slide 15 text

Versioner ● Custom Versioner based on github.com/Microsoft/code-push ● Hosted on our own server (S3) ● Update directly to client devices without Play Store approval

Slide 16

Slide 16 text

Split Build ● universalApk = false ● ARM & X86 build ● Before Split Build: 13 MB ● After Split Build ○ ARM: 6.9 MB ○ X86: 8 MB

Slide 17

Slide 17 text

APK File Size

Slide 18

Slide 18 text

@sonnylazuardi