How and why we choose to integrate React Native into our native app
http://artsy.github.io/artsy-x-react-native.html
React Native &Existing iOS ProjectsEloy Durán
View Slide
• Ruby Developer since 2004• Mac Developer since 2006• iOS Developer since 2009Me! —Eloy Durán
• RubyCocoa• MacRuby• RubyMotionMe! —Eloy Durán
• CocoaPods 2010-2015Me! —Eloy Durán
• React Native since Valentine’s Day 2016 Me! —Eloy Durán
• Xcode SurvivorMe! —Eloy Durán
Artsy —A Future Where Everyone Is Moved By Art Every Day
Artsy —Open Source By Default
Eigen —Native iOS App Since 20121. Drop Screenshot Here2. Resize to cover pink area
Emission —React Native Views Since April 20161. Drop Screenshot Here2. Resize to cover pink area
Introducing React Native Into Our Codebase —Why?
Why —Simpler Mental Model
Why —Spaghetti Code
Why —New Paradigm
Why —Networking
Why —Request Waterfall
Why —GraphQL
Why —De-silo people
Why —Pair up
Why —Improve developer experience
Why —Expand platform support
Why —Android
Swift —Optimised
Swift —Developer Experience
Swift —Just a language
• Simpler Mental Model• Simpler and more efficient networking• De-silo people• Improve developer experience• Expand platform supportWhy React Native —Summary
Introducing React Native Into Our Codebase —How?!
How —Integration
How —Package
How —CocoaPods pros
How —CocoaPods cons
How —Routing
How —Mixed1. Drop Screenshot Here2. Resize to cover pink area
class Artwork extends React.Component {handleTap() {SwitchBoard.presentNavigationViewController(this, this.props.artwork.href)}// ...}class SearchBar extends React.Component {handleTap() {Switchboard.presentModalViewController(this, "/search")}// ...}Mixed —How
@implementation AREmissionSetup- (void)configureEmissionInstance:(AREmission *)emission;{emission.switchBoardModule.presentNavigationViewController = ^(UIViewController * _Nonnull fromViewController,NSString * _Nonnull route) {[fromViewController.navigationController pushViewController:[self viewControllerForRoute:route]animated:YES];};emission.switchBoardModule.presentModalViewController = ^(UIViewController * _Nonnull fromViewController,NSString * _Nonnull route) {UIViewController *viewController = [self viewControllerForRoute:route];UINavigationController *navigationController = [self navigationControllerWithRootViewController:viewController];[fromViewController.navigationController presentViewController:navigationController animated:YES completion:nil];};}// ...@endMixed —How
How —Nested Scrollviews
How —Demo time!
How —Event Forwarding
How —Shared Caching
How —Opaque Drawing
Introducing React Native Into Our Codebase —Conclusions