Slide 1

Slide 1 text

React Native: cross-platform mobile app development

Slide 2

Slide 2 text

Your host Senne Van Cauwenberge Android & React Native Consultant [email protected] @appfoundry

Slide 3

Slide 3 text

AppFoundry

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

What to expect: ◦ The origins of React Native ◦ The 0s and 1s of React Native ◦ Hands-on lab ◦ ? ◦ Profit! React Native

Slide 6

Slide 6 text

The origins of React Native ◦ Hackathon in 2013 @ ◦ React JS ◦ Van closed naar open-source ◦ v0.0.1 – maart 2015 ◦ v.0.11 – september 2015

Slide 7

Slide 7 text

The origins of React Native ◦ Februari 2016: # commits extern > intern 2015 - 2016

Slide 8

Slide 8 text

The origins of React Native https://octoverse.github.com

Slide 9

Slide 9 text

The origins of React Native

Slide 10

Slide 10 text

The 0s and 1s of React Native

Slide 11

Slide 11 text

The 0s and 1s of React Native 0: Write Once, Run Anywhere 1: Learn Once, Write Anywhere

Slide 12

Slide 12 text

The 0s and 1s of React Native 0: gemakkelijk en snel voor meerdere platformen tegelijkertijd ontwikkelen 1: gemakkelijk en snel voor een specifiek platform ontwikkelen “Different platforms have different looks, feels, and capabilities, and as such, we should still be developing discrete apps for each platform, but the same set of engineers should be able to build applications for whatever platform they choose, without needing to learn a fundamentally different set of technologies for each.” - Tom Occhino

Slide 13

Slide 13 text

The 0s and 1s of React Native 0: WebViews – using React 1: Native counterparts, platform specific components React JavaScriptCore Higher-level platform-specific components “The bridge” 10/10 would not recommend

Slide 14

Slide 14 text

The 0s and 1s of React Native 0: , , , 1:
, ,
    • ,
  • Slide 15

    Slide 15 text

    Coding Example The 0s and 1s of React Native import React, { Component } from 'react' import { Text, View } from 'react-native' class UIComponentsSample extends Component { render() { return ( If you like React on the web, you'll like React Native. You just use native components like 'View' and 'Text', instead of web components like 'div' and 'span'. ); } } ... render() { return ( ); } … render() { return ( ); }

    Slide 16

    Slide 16 text

    The 0s and 1s of React Native 0: classNames & pure CSS 1: style objecten in JavaScript

    Slide 17

    Slide 17 text

    Coding Example The 0s and 1s of React Native import React, { Component } from 'react'; import { Text, View, StyleSheet } from 'react-native' class WhatsYourStyle extends Component { render() { return ( Some red text. Some big text in blue. Some big bold blue text overwritten to red. Some text styled inline to be huge and green. ) } } const styles = StyleSheet.create({ bigblue: { color: 'blue', fontWeight: 'bold', fontSize: 30 }, red: { color: 'red' } })

    Slide 18

    Slide 18 text

    The 0s and 1s of React Native 0: JavaScript + Native code 1: JavaScript + Native Code

    Slide 19

    Slide 19 text

    The 0s and 1s of React Native 0: Windows supported 1: Windows not supported

    Slide 20

    Slide 20 text

    Hands-on lab

    Slide 21

    Slide 21 text

    Hands-on lab ◦ Setup ◦ Routing/Navigation ◦ Containers ◦ Components ◦ Native modules ◦ Testing ◦ Deployment ◦ Follow-up

    Slide 22

    Slide 22 text

    Hands-on: Setup ◦ $ node –v (min. v6) ◦ $ npm install -g create-react-native-app of $ yarn global add create-react-native-app ◦ $ create-react-native-app rn-intro ◦ Emulator / Simulator / Device ◦ $ npm install -g react-native-cli (niet verplicht) ◦ OS X: $ brew install watchman (mss nodig)

    Slide 23

    Slide 23 text

    $ node –v $ npm install -g create-react-native-app of $ yarn global add create-react-native-app $ create-react-native-app rn-intro Hands-on: Setup Create React Native App ◦ Minimal ‘Time to Hello World” ◦ Test anywhere (emu/sim/device) ◦ 1 build tool (no xcode/android studio/..) ◦ No lock-in (“eject”-able om zelf controle te nemen) ◦ Expo

    Slide 24

    Slide 24 text

    $ node –v $ npm install -g create-react-native-app of $ yarn global add create-react-native-app $ create-react-native-app rn-intro Hands-on: Setup Expo ◦ Injecteert eigen SDK met native modules ◦ Audio, Bluetooth, Contacts, Location, MapView, … ◦ Klein nadeel: delayed releases ◦ Build tool (via Expo of stand-alone) ◦ Via Expo app overal testbaar ◦ Guides/documentatie

    Slide 25

    Slide 25 text

    Hands-on: Setup ◦ $ create-react-native-app rn-intro ◦ $ cd /rn-intro

    Slide 26

    Slide 26 text

    Create React Native App ◦ $ npm start ◦ $ npm test ◦ $ npm run ios ◦ $ npm run android ◦ $ npm run eject (onomkeerbaar!) Hands-on: Setup

    Slide 27

    Slide 27 text

    ◦ $ npm start ◦ Developer menu ◦ Reload: refresh JavaScript shortcut RR / ⌘ R ◦ Debug JS Remotely: Chrome - React Developer Tools ◦ Live Reload: ipv manueel ◦ Hot Reload: ipv full reload ◦ Inspector: overlay om UI elementen te inspecteren ◦ Perf Monitor: fps Hands-on: Setup

    Slide 28

    Slide 28 text

    Hands-on: Routing ◦ Setup Routing/Navigation ◦ Containers ◦ Components ◦ Native modules ◦ Testing ◦ Deployment ◦ Follow-up

    Slide 29

    Slide 29 text

    Hands-on: Routing React Native Navigation ◦ 100% Native ◦ Wix engineering ◦ ~setup React Navigation ◦ Native/JavaScript mix ◦ Expo React Native Router Flux ◦ React Navigation + Flux Patroon

    Slide 30

    Slide 30 text

    React Navigation ◦ StackNavigator – TabNavigator – DrawerNavigator ◦ Redux ◦ Deep linking (rnapp://return/item) ◦ Screen tracking (analytics) ◦ Configurable ◦ Customizable ◦ Documentatie soms wat vaag Hands-on: Routing

    Slide 31

    Slide 31 text

    Hands-on: Routing StackNavigator ◦ npm install react-navigation –save ◦ https://reactnavigation.org

    Slide 32

    Slide 32 text

    Hands-on lab ◦ Setup ◦ Routing/Navigation Containers Components ◦ Native modules ◦ Testing ◦ Deployment ◦ Follow-up

    Slide 33

    Slide 33 text

    Hands-on lab Containers ◦ Logica (smart) ◦ Stateful ◦ Data handling ◦ Higher-order Components ◦ Redux, Relay, Flux, MobX ◦ Vb: SideBarContainer, HeaderContainer, UserList, … Components ◦ Geen logica (dumb) ◦ Stateless ◦ Data receiving ◦ Vb: SideBarItem, HeaderTitle, HeaderIcon, UserListItem, …

    Slide 34

    Slide 34 text

    Hands-on lab Top-down data flow HomeScreen Form Name field Header Greeting message

    Slide 35

    Slide 35 text

    Hands-on lab ◦ Setup ◦ Routing/Navigation ◦ Containers ◦ Components Native modules ◦ Testing ◦ Deployment ◦ Follow-up

    Slide 36

    Slide 36 text

    Hands-on lab ◦ Setup ◦ Routing/Navigation ◦ Containers ◦ Components ◦ Native modules Testing ◦ Deployment ◦ Follow-up

    Slide 37

    Slide 37 text

    Hands-on: Testing Jest ◦ React Native OG ◦ Eenvoudige setup ◦ Snapshots ◦ Auto-migrate ◦ Ook voor Web frameworks Redux, Angular, Vue, MobX

    Slide 38

    Slide 38 text

    Hands-on: Testing Detox ◦ end-to-end testing ◦ Emulator ◦ iOS, Android soon™ ◦ Werkt niet op sommige versies van React Native

    Slide 39

    Slide 39 text

    Hands-on lab ◦ Setup ◦ Routing/Navigation ◦ Containers ◦ Components ◦ Native modules ◦ Testing Deployment ◦ Follow-up

    Slide 40

    Slide 40 text

    Hands-on: Deployment Deployment ◦ Expo account nodig ◦ app.json: naam, splash, icon, scheme, keys, … ◦ App / Play store: stand-alone builds (beta) ◦ $ exp start ◦ $ exp build: ◦ Expo: ◦ $ exp publish ◦ Silent remote updates

    Slide 41

    Slide 41 text

    Hands-on lab ◦ Setup ◦ Routing/Navigation ◦ Containers ◦ Components ◦ Native modules ◦ Testing ◦ Deployment Follow-up

    Slide 42

    Slide 42 text

    Hands-on: Follow-up Follow-up ◦ Analytics ◦ Firebase Analytics ◦ Fabric.io ◦ Error-tracking ◦ Sentry ◦ Crashlytics (Fabric.io) ◦ Firebase Crash Reporting

    Slide 43

    Slide 43 text

    Hands-on: Follow-up Follow-up ◦ Updates ◦ Expo ◦ CodePush ◦ New builds

    Slide 44

    Slide 44 text

    The magical world of NPM JS.coach

    Slide 45

    Slide 45 text

    ..? Profit!

    Slide 46

    Slide 46 text

    Questions? Senne Van Cauwenberge Android & React Native Consultant [email protected] @appfoundry

    Slide 47

    Slide 47 text

    No content

    Slide 48

    Slide 48 text

    Thank you!