react native - muffin man - introduction to react... · developer at work&co in brooklyn ......

20
(Introduction to) REACT NATIVE

Upload: vuongdien

Post on 07-Feb-2018

227 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

(Introduction to)REACT NATIVE

Page 2: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

Zeh Fernando:

Developer at Work&Co in Brooklyn

Born in São Paulo, Brazil

Working as a (mostly front-end) developer since 1994

@zeh on Twitter, etc

Page 3: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

What it is

Framework and tools to build native iOS and Androidapplications using React and JavaScript

Page 4: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

What it isn't

A webview-based application wrapperlike Cordova/PhoneGap/Appcelerator Titanium/Ionic/etc

Page 5: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

Before

Page 6: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

After

Page 7: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

After

Page 8: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

(Really) After

Page 9: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

If you're a (native) mobile developer...

Declarative UI development ("what", not "how")

React means continuous diffing & rendering ("reconciliation")

Better developer experience (really!) with reloading

Page 10: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

If you're a React (web) developer...

No HTML/DOM, no "browser"

Flexbox(ish) and absolute positioning only

No real CSS, more like inline styles

Lots can be reused, but not everything; you might need native code

Clever solutions for speed (animations)

Fixed build workflow, but webpack-ish

Page 11: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

import React, { Component } from 'react';import { Image, ScrollView, StyleSheet, Text, View } from 'react-native';import { SomeNativeComponent } from './SomeNativeComponent';

const styles = StyleSheet.create({ container: { padding: 20, }, bigblue: { color: 'blue', fontWeight: 'bold', fontSize: 30, }, red: { color: 'red', },});

export default class ScrollingImageWithText extends Component { render() { return ( <ScrollView> <SomeNativeComponent text={'The title'} /> <View style={ styles.container }> <Image source={{ uri: 'https://i.chzbgr.com/full/7345954048/h7E2C65F9/' }} /> <Text style={ styles.bigblue }> If you like React on the web, you'll like React Native. </Text> </View> <Text style={[ styles.bigblue, styles.red ]}> This is another piece of text. </Text> </ScrollView> ); }}

Page 12: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';
Page 13: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

But!

Not 100% mature; can be buggy, inconsistent

Confusion in regards to standard approach to things

You need developers with some native knowledge

Page 14: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

You're not afraid of JavaScript/React

You want a consistent cross-platform app

You have custom designs

You want it fast

You value developer comfort

When should you use React Native...

Page 15: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

You don't need cross-platform apps

Your app's designs are heavily platform-specific

You don't have the time or energy tospend on something not 100% mature yet

..and when you should not

Page 16: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';
Page 17: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

Success stories and case studieshttps://facebook.github.io/react-native/showcase.html

Curious?

Page 18: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

Official intro+tutorial (pretty good)https://facebook.github.io/react-native/docs/getting-started.html

Get started

Page 19: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

Examples (check UIExplorer)

https://github.com/facebook/react-native#examples

Roadmaphttps://github.com/facebook/react-native/wiki/Roadmap

Many third-party componentshttps://github.com/react-native-community (semi-official)

https://js.coach/react-native (curated list)

Page 20: REACT NATIVE - Muffin Man - Introduction to React... · Developer at Work&Co in Brooklyn ... (native) mobile developer ... { Image, ScrollView, StyleSheet, Text, View } from 'react-native';

^Z