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

React Native on tvOS

Neil Kimmett
January 26, 2018

React Native on tvOS

Not many people are aware you can use React Native to create Apple TV apps. This talk will give an overview of how it works, and explore some of the unique challenges you face. In particular it will dive into the process of wrapping the native UISearchController component so we can use it from React Native.

Neil Kimmett

January 26, 2018
Tweet

More Decks by Neil Kimmett

Other Decks in Technology

Transcript

  1. Plan • hi • Build grid view in RN •

    Wrap grid in tvOS tab bar • Add a native search tab • bye ✌
  2. RN on tvOS Basics • mostly the same as iOS

    • input with remote, not touch • a little rough around the edges
  3. UITabBarController • owns a list of UIViewControllers, one for each

    tab • each UIViewController owns a UITabBarItem it uses to describe it's tab in the tab bar
  4. Navigation libraries - react-navigation JS reimplementation of navigation - airbnb/native-navigation

    Swift native navigation (beta) - wix/react-native-navigation “a complete native navigation solution”
  5. JS vs ObjC var mittens = new Cat(“Mittens”); Cat *mittens

    = [[Cat alloc] initWithName:@“Mittens”];
  6. JS vs ObjC @interface Cat : Animal @property NSString *name;

    - (instancetype)initWithName:(NSString *)name; @end
  7. JS vs ObjC @interface Cat : Animal @property NSString *name;

    - (Cat *)initWithName:(NSString *)name; @end
  8. Native components • inherit from UIView • paired with a

    Manager class to expose to React https://facebook.github.io/react-native/docs/native-components-ios.html
  9. Native components import { requireNativeComponent } from ‘react-native’; var Map

    = requireNativeComponent('Map', null); <Map /> https://facebook.github.io/react-native/docs/native-components-ios.html
  10. Recap • hi • Build grid view in RN •

    Wrap grid in tvOS tab bar • Add a native search tab • bye ✌