Top Banner
What’s This React Na.ve Thing I Keep Hearing About? Evan K. Stone Senior iOS Developer Cloud City Development // San Francisco
103

What's This React Native Thing I Keep Hearing About?

Apr 11, 2017

Download

Software

Evan Stone
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: What's This React Native Thing I Keep Hearing About?

What’s This React Na.ve Thing I Keep Hearing About?

Evan K. Stone Senior iOS Developer

Cloud City Development // San Francisco

Page 2: What's This React Native Thing I Keep Hearing About?

An integrated design and so-ware consultancy specializing in web and mobile apps

Page 3: What's This React Native Thing I Keep Hearing About?

iOS Dev Break Podcast

iOS Dev Break: 15 minutes of current events, 8ps, and advice for iOS Developers!

Page 4: What's This React Native Thing I Keep Hearing About?

Quick Clarifica.on.

Page 5: What's This React Native Thing I Keep Hearing About?

This talk is…

Page 6: What's This React Native Thing I Keep Hearing About?

1. A brief overview of React Na.ve

Page 7: What's This React Native Thing I Keep Hearing About?

2. Good Stuff/Bad Stuff in React Na.ve

Page 8: What's This React Native Thing I Keep Hearing About?

3. Reasons why you may want to use React Na.ve…

Page 9: What's This React Native Thing I Keep Hearing About?

…or not.

Page 10: What's This React Native Thing I Keep Hearing About?

This talk is not…

Page 11: What's This React Native Thing I Keep Hearing About?

A tutorial about React Na.ve

Page 12: What's This React Native Thing I Keep Hearing About?

A deep-dive into React Na.ve

Page 13: What's This React Native Thing I Keep Hearing About?

A mo.va.onal speech about why everyone should drop everything and switch to Javascript and learn a totally new development paradigm

for crea.ng mobile applica.ons

Page 14: What's This React Native Thing I Keep Hearing About?

Reminder:

Page 15: What's This React Native Thing I Keep Hearing About?

I’m an iOS/SwiV developer.

Page 16: What's This React Native Thing I Keep Hearing About?

I run an iOS development podcast.

Page 17: What's This React Native Thing I Keep Hearing About?

🤔

Page 18: What's This React Native Thing I Keep Hearing About?
Page 19: What's This React Native Thing I Keep Hearing About?

OK, but seriously, what is it?

Page 20: What's This React Native Thing I Keep Hearing About?

What is this React Na.ve thing I keep hearing about?

Page 21: What's This React Native Thing I Keep Hearing About?

A Javascript-based development framework for crea.ng mobile

applica.ons

Page 22: What's This React Native Thing I Keep Hearing About?

Not a hybrid app running inside a webview

Page 23: What's This React Native Thing I Keep Hearing About?

Not (always) a wrapper around na.ve components

Page 24: What's This React Native Thing I Keep Hearing About?

Side note…

Page 25: What's This React Native Thing I Keep Hearing About?

This was a big confusion point for me.

Page 26: What's This React Native Thing I Keep Hearing About?

You can use ES6

Page 27: What's This React Native Thing I Keep Hearing About?

…and some ES7.

Page 28: What's This React Native Thing I Keep Hearing About?

Example: async/await

Page 29: What's This React Native Thing I Keep Hearing About?

ES6 - Feels a li`le more "SwiVy"

Page 30: What's This React Native Thing I Keep Hearing About?

let and const

Page 31: What's This React Native Thing I Keep Hearing About?

🙄

Page 32: What's This React Native Thing I Keep Hearing About?

JSXJavaScript XML

Page 33: What's This React Native Thing I Keep Hearing About?

<View style={styles.headerContainer}> <Text style={styles.headerMessage}>Messages</Text> <TextInput style={styles.textInput} onChangeText={(entryText) => this.setState({entryText})} onSubmitEditing={(event) => this.onGoButtonPressed()} placeholder={'Enter Message'} value={this.state.entryText} returnKeyType="go" /> </View>

Page 34: What's This React Native Thing I Keep Hearing About?

state

Page 35: What's This React Native Thing I Keep Hearing About?

props

Page 36: What's This React Native Thing I Keep Hearing About?

To learn more…

Page 37: What's This React Native Thing I Keep Hearing About?

React Na.ve JavaScript Environment

h`ps://facebook.github.io/react-na.ve/docs/javascript-environment.html

Page 38: What's This React Native Thing I Keep Hearing About?

JavaScript CSS and Flexbox

Page 39: What's This React Native Thing I Keep Hearing About?
Page 40: What's This React Native Thing I Keep Hearing About?

The Good, The Bad, and The Amazing

Page 41: What's This React Native Thing I Keep Hearing About?

The Good.

Page 42: What's This React Native Thing I Keep Hearing About?

It works!

Page 43: What's This React Native Thing I Keep Hearing About?

Cross-Plahorm Magic

Page 44: What's This React Native Thing I Keep Hearing About?

JavaScript

Page 45: What's This React Native Thing I Keep Hearing About?

Debugging with Chrome

Page 46: What's This React Native Thing I Keep Hearing About?

Wait, What???

Page 47: What's This React Native Thing I Keep Hearing About?

CSS

Page 48: What's This React Native Thing I Keep Hearing About?

Components

Page 49: What's This React Native Thing I Keep Hearing About?

KeyboardAvoidingView

Page 50: What's This React Native Thing I Keep Hearing About?

Build-your-own Components

Page 51: What's This React Native Thing I Keep Hearing About?

<View style={Style.sceneContainer}> <View style={Style.subNav}> <Text style={Style.subNavText}></Text> </View> <View style={styles.loadingIndicatorContainer}> <View> <ActivityIndicator animating={this.state.animating} color={indicatorColor} size={indicatorSize} /> <Text style={styles.message}>{message}</Text> </View> </View> </View>

Page 52: What's This React Native Thing I Keep Hearing About?

<View style={Style.sceneContainer}> <View style={Style.subNav}> <Text style={Style.subNavText}></Text> </View> <View style={styles.loadingIndicatorContainer}> <View> <ActivityIndicator animating={this.state.animating} color={indicatorColor} size={indicatorSize} /> <Text style={styles.message}>{message}</Text> </View> </View> </View>

Page 53: What's This React Native Thing I Keep Hearing About?

<View style={Style.sceneContainer}> <View style={Style.subNav}> <Text style={Style.subNavText}></Text> </View> <View style={styles.loadingIndicatorContainer}> <LoadingIndicator containerStyle={styles.loadingIndicator} show={true} /> </View> </View>

Page 54: What's This React Native Thing I Keep Hearing About?

PropTypes

Page 55: What's This React Native Thing I Keep Hearing About?

AddButton.propTypes = { buttonText: PropTypes.string, onPress: PropTypes.func.isRequired, style: PropTypes.oneOfType([ PropTypes.object, PropTypes.array, PropTypes.number, ]), }

Page 56: What's This React Native Thing I Keep Hearing About?

<View style={styles.buttonAlign}> <AddButton style={styles.addButton} buttonText="Add a Message" onPress={() => this.onAddMessageButtonPress()} /> </View>

Page 57: What's This React Native Thing I Keep Hearing About?
Page 58: What's This React Native Thing I Keep Hearing About?

The Bad.

Page 59: What's This React Native Thing I Keep Hearing About?

Cross-Plahorm Oddi.es and Irrita.ons

Page 60: What's This React Native Thing I Keep Hearing About?

Fonts

Page 61: What's This React Native Thing I Keep Hearing About?

Picker

Page 62: What's This React Native Thing I Keep Hearing About?

Developing for Android

Page 63: What's This React Native Thing I Keep Hearing About?

Op.onal: Javascript

Page 64: What's This React Native Thing I Keep Hearing About?

Docs

Page 65: What's This React Native Thing I Keep Hearing About?

Pace of React Na.ve Releases(But it’s geing be`er!!!)

Page 66: What's This React Native Thing I Keep Hearing About?
Page 67: What's This React Native Thing I Keep Hearing About?

The Awesome.

Page 68: What's This React Native Thing I Keep Hearing About?

Fetchh`ps://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

Page 69: What's This React Native Thing I Keep Hearing About?

🐶

Page 70: What's This React Native Thing I Keep Hearing About?

fetchMessages() { const url = 'http://localhost:3000/messages'; fetch(url, { method: 'GET', }) .then((response) => response.json()) .then((json) => { this.setState({ dataSource: this.state.dataSource.cloneWithRows(json) }); }) .catch(error => { console.log(error); Alert.alert( 'Refresh Failed', 'An error occurred while retrieving messages.', [ {text: 'OK'} ] ); }); }

Page 71: What's This React Native Thing I Keep Hearing About?

fetchMessages() { const url = 'http://localhost:3000/messages'; fetch(url, { method: 'GET', }) .then((response) => response.json()) .then((json) => { this.setState({ dataSource: this.state.dataSource.cloneWithRows(json) }); }) .catch(error => { console.log(error); Alert.alert( 'Refresh Failed', 'An error occurred while retrieving messages.', [ {text: 'OK'} ] ); }); }

Page 72: What's This React Native Thing I Keep Hearing About?

JSON

Page 73: What's This React Native Thing I Keep Hearing About?

No parsing necessary.

Page 74: What's This React Native Thing I Keep Hearing About?

It is the thing you want already.

Page 75: What's This React Native Thing I Keep Hearing About?

Excep.on: Extrac.ng Per.nent Data

Page 76: What's This React Native Thing I Keep Hearing About?

Flexboxh`ps://facebook.github.io/react-na.ve/docs/flexbox.html

Page 77: What's This React Native Thing I Keep Hearing About?

Redux

Page 78: What's This React Native Thing I Keep Hearing About?

Refreshing app in iOS Simulator with CMD-R

Page 79: What's This React Native Thing I Keep Hearing About?

Automa.c Refresh!

Page 80: What's This React Native Thing I Keep Hearing About?

Docs: Run This Example

Page 81: What's This React Native Thing I Keep Hearing About?
Page 82: What's This React Native Thing I Keep Hearing About?

The Elephant in the Room

Page 83: What's This React Native Thing I Keep Hearing About?
Page 84: What's This React Native Thing I Keep Hearing About?

Why?

Page 85: What's This React Native Thing I Keep Hearing About?

Why should I care?

Page 86: What's This React Native Thing I Keep Hearing About?

Who is this for?

Page 87: What's This React Native Thing I Keep Hearing About?

Should I use it?

Page 88: What's This React Native Thing I Keep Hearing About?
Page 89: What's This React Native Thing I Keep Hearing About?

But seriously…

Page 90: What's This React Native Thing I Keep Hearing About?

Who are your users?

Page 91: What's This React Native Thing I Keep Hearing About?

Who are your clients?

Page 92: What's This React Native Thing I Keep Hearing About?

Who are their customers?

Page 93: What's This React Native Thing I Keep Hearing About?
Page 94: What's This React Native Thing I Keep Hearing About?
Page 95: What's This React Native Thing I Keep Hearing About?

Side note…

Page 96: What's This React Native Thing I Keep Hearing About?
Page 97: What's This React Native Thing I Keep Hearing About?

Who are their customers?

Page 98: What's This React Native Thing I Keep Hearing About?
Page 99: What's This React Native Thing I Keep Hearing About?

To learn more…

Page 100: What's This React Native Thing I Keep Hearing About?

React Na.ve Docs h`ps://facebook.github.io/react-na.ve/docs/geing-started.html

Paul Hudson - Going Na.ve with React h`ps://forwardcourses.com/workshops/64

Tim Garcia - React Na.ve: Mobile Apps Without SwiV Free trial at Forward Courses!

Page 101: What's This React Native Thing I Keep Hearing About?
Page 102: What's This React Native Thing I Keep Hearing About?

Evan K. Stone

web: h<p://www.cloudcity.io

cloud city blog: h<p://blog.cloudcity.io

blog: h<p://www.interac?velogic.net

twi<er: @interac?vlogic

Page 103: What's This React Native Thing I Keep Hearing About?

h`p://www.iosdevbreak.com

iOS Dev Break Podcast

Twi`er: @iOSDevBreak

Subscribe on iTunes/Overcast: iOS Dev Break