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

React Native: The Development Flow

React Native: The Development Flow

React Native is slowly becoming the preferred choice for developing mobile applications. If you are already a web developer, you will find that most of the principles of coding remain the same as it uses the same design as React. But the development flow might feel a bit overwhelming for someone who is creating a React Native app for the first time.

In this talk, I will describe the various tools and methods that can simplify your development workflow. I will talk about the whys and hows of debugging, performance optimizations and improved release cycles so that the next time you are developing a React Native application, you feel at home.

Ritesh Kumar

May 26, 2018
Tweet

More Decks by Ritesh Kumar

Other Decks in Technology

Transcript

  1. import React from "react"; import { storiesOf } from "@storybook/react-native";

    import CenterView from "./CenterView"; import Button from "components/GenericButton"; import colors from "utilities/colors"; storiesOf("GenericButton", module) .addDecorator(getStory "=> <CenterView>{getStory()}"</CenterView>) .add("Default", () "=> [ <Button title={"Hello"} key={1} "/>, <Button title={"Hello"} key={2} color={colors.red} "/>, <Button title={"Hello"} key={2.1} color={colors.red} disabled "/>, <Button title={"Hello"} key={3} filled "/>, <Button title={"Hello"} key={3.1} filled disabled "/>, <Button title={"Hello"} key={4} iconName={"update"} "/> ]); "// .add ("Another Configuration", () "=> "// <Button "/> )
  2. <svg xmlns="http:"//""www.w3.org/2000/svg" width=“200" height="100" version="1.1" > <rect width="200" height="100" stroke="black"

    stroke-width="6" fill="green" "/> "</svg> import Svg, { Rect } from "react-native-svg" export default function() { return ( <Svg width={200} height={100}> <Rect width={200} height={100} stroke="#000" strokeWidth={6} fill="green" "/> "</Svg> ) } HTML Code React Native Code
  3. requestAnimationFrame requestAnimationFrame(() "=> { "// ""...task""... }); • Runs code

    before next repaint • If you are using Animated API, it takes care of the frame updates for you.
  4. Open Devtools Refresh on file Change Update Changed Code Inspect

    components & Touchable areas FPS Monitor
  5. • Use default debugger unless it isn’t useful. It’s fast

    • Turn off network monitoring if you don’t need it
  6. Live Reload • Reloads the entire page. • State is

    lost. • Updates the changed code. • State is not lost. Hot Reloading
  7. import * as Rx from “rxjs"; this.devModeStream = new Rx.Subject();

    this.devModeStream .bufferWhen(() "=> this.devModeStream.debounceTime(1000)) .filter(x "=> x.length ">= 6) .subscribe(this.toggleDevMode); Create a stream
  8. import * as Rx from “rxjs"; this.devModeStream = new Rx.Subject();

    this.devModeStream .bufferWhen(() "=> this.devModeStream.debounceTime(1000)) .filter(x "=> x.length ">= 6) .subscribe(this.toggleDevMode); onClick this.devModeStream.next(event);
  9. Minor (2.5.x) Major (2.6.0) All PRs that will go in

    CodePush Update Native release Beta Beta Native