Upgrade to Pro — share decks privately, control downloads, hide ads and more …

React Native - Bringing modern web technologies...

Lidan
May 25, 2016

React Native - Bringing modern web technologies to mobile

Lidan Hifi, Wix.com

Lidan

May 25, 2016
Tweet

More Decks by Lidan

Other Decks in Technology

Transcript

  1. Slow Development Cycle Different APIs to Code Same Things Slow

    Deployment Cycle Separate Platform Teams
  2. Slow Development Cycle Different APIs to Code Same Things Slow

    Deployment Cycle Separate Platform Teams
  3. 10 Imperative UI: Define Transitions 10 99+ 10 10 99+

    10 99+ 99+ 99+ 99+ 10 3 states, 9 transitions
  4. 10 Imperative UI: Define Transitions 10 99+ 10 10 99+

    10 99+ 99+ 99+ 99+ 10 3 states, 9 transitions O(n2)
  5. Imperative UI: Define Transitions if (count == 0) { if

    (hasBadge()) { removeBadge(); } if (isSad()) { removeSadFace(); } addStars(); smile(); return; }
  6. Imperative UI: Define Transitions else if (count <= 99) {

    if (isSmile()) { removeSmile(); } if (sad()) { removeSadFace(); } if (hasStars()) { removeStars(); } if (!hasBadge()) { addBadge(); } }
  7. Imperative UI: Define Transitions else { if (hasStars()) { removeStars();

    } if (!hasBadge()) { addBadge(); } if (isSmile()) { removeSmile(); } setSadFace(); } let count = count > 99 ? '99+' : count.toString(); getBadge().setText(count);
  8. Declarative UI: Define States if (count === 0) { return

    <Bell style={styles.smile} /> } else if (count <= 99) { return ( <Bell> <Bedge count={count} /> </Bell> ); }
  9. Declarative UI: Define States if (count === 0) { return

    <Bell style={styles.smile} /> } else { return ( <Bell style={styles.sad}> <Badge count="99+" /> </Bell> ); } else if (count <= 99) { return ( <Bell> <Bedge count={count} /> </Bell> ); }
  10. React Component render() { } } class HelloMessage extends React.Component

    { return <div>Hello {this.props.name}</div>; <HelloMessage name="Lidan" />
  11. React Component: Adding State class Counter extends React.Component { }

    constructor(props) { super(props); this.state = {count: 0}; this.tick = this.tick.bind(this); } tick() { this.setState({count: this.state.count + 1}); } render() { return ( <div onClick={this.tick}> Clicks: {this.state.count} </div> ); }
  12. React Component: Adding State class Counter extends React.Component { }

    constructor(props) { super(props); this.state = {count: 0}; this.tick = this.tick.bind(this); } tick() { this.setState({count: this.state.count + 1}); } render() { return ( <div onClick={this.tick}> Clicks: {this.state.count} </div> ); }
  13. React Component: Adding State class Counter extends React.Component { }

    constructor(props) { super(props); this.state = {count: 0}; this.tick = this.tick.bind(this); } tick() { this.setState({count: this.state.count + 1}); } render() { return ( <div onClick={this.tick}> Clicks: {this.state.count} </div> ); }
  14. React Component: Adding State class Counter extends React.Component { }

    constructor(props) { super(props); this.state = {count: 0}; this.tick = this.tick.bind(this); } tick() { this.setState({count: this.state.count + 1}); } render() { return ( <div onClick={this.tick}> Clicks: {this.state.count} </div> ); }
  15. React Component: Adding State class Counter extends React.Component { }

    constructor(props) { super(props); this.state = {count: 0}; this.tick = this.tick.bind(this); } tick() { this.setState({count: this.state.count + 1}); } render() { return ( <div onClick={this.tick}> Clicks: {this.state.count} </div> ); }
  16. React Component: Adding State class Counter extends React.Component { }

    constructor(props) { super(props); this.state = {count: 0}; this.tick = this.tick.bind(this); } tick() { this.setState({count: this.state.count + 1}); } render() { return ( <div onClick={this.tick}> Clicks: {this.state.count} </div> ); }
  17. React Component: Adding State class Counter extends React.Component { }

    constructor(props) { super(props); this.state = {count: 0}; this.tick = this.tick.bind(this); } tick() { this.setState({count: this.state.count + 1}); } render() { return ( <div onClick={this.tick}> Clicks: {this.state.count} </div> ); } <Counter />
  18. From Web to Mobile <div /> <View /> UIView <span

    /> <Text /> UILabel <img /> <Image /> UIImageView web react-native iOS native
  19. React Native Components ActivityIndicatorIOS DatePickerIOS DrawerLayoutAndroid Image ListView MapView Modal

    Navigator PickerIOS Picker ProgressBarAndroid ProgressViewIOS WebView ScrollView SegmentedControlIOS Slider SliderIOS StatusBar Switch TabBarIOS TabBarIOS.Item Text TextInput ToolbarAndroid View
  20. Getting Started • Install NodeJS • Install React Native npm

    install -g react-native-cli • Create a new RN project react-native init MyProject • Run the application react-native run-ios react-native run-android
  21. References React Native Official docs- facebook.github.io/react-native Make it Open- Building

    the F8 App— makeitopen.com Wix Engineering- www.wix.engineering Awesome react native- https://github.com/jondot/awesome-react-native
  22. References React Native Official docs- facebook.github.io/react-native Make it Open- Building

    the F8 App— makeitopen.com Wix Engineering- www.wix.engineering Awesome react native- https://github.com/jondot/awesome-react-native
  23. References React Native Official docs- facebook.github.io/react-native Make it Open- Building

    the F8 App— makeitopen.com Wix Engineering- www.wix.engineering Awesome react native- https://github.com/jondot/awesome-react-native
  24. References React Native Official docs- facebook.github.io/react-native Make it Open- Building

    the F8 App— makeitopen.com Wix Engineering- www.wix.engineering Awesome react native- https://github.com/jondot/awesome-react-native
  25. References React Native Official docs- facebook.github.io/react-native Make it Open- Building

    the F8 App— makeitopen.com Wix Engineering- www.wix.engineering Awesome react native- https://github.com/jondot/awesome-react-native