react native

32
React Native Artyom Trityak

Upload: artyom-trityak

Post on 16-Apr-2017

3.833 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: React Native

React NativeArtyom Trityak

Page 2: React Native

NATIVE mobile appsSeparated thread Native UI

Events bridge

Page 3: React Native

How to start• Buy Mac, install Xcode

• Install node.js, npm

• npm install -g react-native-cli

• react-native init LvivJSProject

• Open LvivJSProject.xcodeproj and hit run in Xcode

• Open index.ios.js in text editor and edit some lines

Page 4: React Native

React Native Webpackapp/*.js(x) -> index.ios.js

1

2

3

Page 5: React Native

React Native WebpackFix React Native imports

Page 6: React Native

React Native WebpackESLint

1

2

Page 7: React Native

React Native WebpackESLint

1

Page 8: React Native

RN base concepts• *.js -> index.ios.js

• RN pre-defined tags instead of html

• Inline styles (CSS in JS)

• RN components (like using components library)

Page 9: React Native

RN pre-defined tags

Page 10: React Native

JSS and StyleSheet• CSS StyleSheets abstraction -> iOS layout

• Flexbox from Web to Native

• Immutable

• Optimized (cached in table, using reference)

Page 11: React Native

JSS and StyleSheet

Page 12: React Native

JSS and StyleSheet

Page 13: React Native

JSS and StyleSheet

Page 14: React Native

Basic NATIVE components

TabBarIOS AlertIOS

Page 15: React Native

Basic NATIVE components

NavigatorIOS (title, swipes, back, etc) ActivityIndicatorIOS

Page 16: React Native

Basic NATIVE components

TouchableHighlight SwitchIOS

Page 17: React Native

Basic NATIVE components

PickerIOS SliderIOS

Page 18: React Native

Basic NATIVE components

• AsyncStorage (key-value pairs)

• TextInput

• View

• TouchableHighlight

Page 19: React Native

Network requests

XMLHttpRequeston top of iOS networking APIs

Page 20: React Native

Network requests

Page 21: React Native

Network requests

Fetchnew browser networking specification implementation top of iOS networking APIs

Page 22: React Native

Network requests

Page 23: React Native

Debugging

Just a browser:console.log, breakpoint

Page 24: React Native

Debugging

Page 25: React Native

Infrastructure

Just

Page 26: React Native

Infrastructure: JS

Page 27: React Native

Infrastructure: JS

Page 28: React Native

Infrastructure: JS

Page 29: React Native

Infrastructure: JS

Page 30: React Native

Infrastructure: JS

Page 31: React Native

Integrating with existing app

• // ReactView.h

• #import <UIKit/UIKit.h>

• @interface ReactView : UIView

• @end

Page 32: React Native