How to do it...

  1. Let's start by updating the ViewController.m implementation file in the native layer. Be sure to open the project in Xcode via the .xcworkspace file in the EmbeddedApp, which we placed in the /ios/EmbeddApp directory of the project in the previous recipe. We'll start with the imports:
#import "ViewController.h"#import "EmbeddedViewController.h"#import <React/RCTRootView.h>#import <React/RCTBridge.h>#import <React/RCTEventDispatcher.h>
  1. The next step is to add a reference to the React Native bridge via the ViewController interface, effectively linking the native controller with the React Native code:
@interface ViewController () <RCTBridgeDelegate> {    EmbeddedViewController *embeddedViewController;    RCTBridge *_bridge; BOOL ...

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.