How to do it...

  1. Let's begin in the native layer. Open the EmbeddedApp native app in Xcode via the .xcworkspace file. We'll first add imports to ViewController.m:
#import "ViewController.h"#import "EmbeddedViewController.h"#import <React/RCTRootView.h>#import <React/RCTBridge.h>#import <React/RCTEventDispatcher.h>
  1. As we did in the last recipe, we need to add a reference to the React Native bridge via the ViewController interface, providing a bridge between the native controller and the React Native code:
@interface ViewController () <RCTBridgeDelegate> {    EmbeddedViewController *embeddedViewController;    RCTBridge *_bridge;    BOOL isRNRunning;}
  1. We will also need a @property reference of userNameField that we will use in a later step to wire ...

Get React Native Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.