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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.